Skip to content

Commit

Permalink
[#2691] Revert adding url_for to plugins.toolkit
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed Dec 19, 2012
1 parent e28cd00 commit 5837ee7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 11 deletions.
4 changes: 0 additions & 4 deletions ckan/plugins/toolkit.py
Expand Up @@ -47,7 +47,6 @@ class _Toolkit(object):
'NotAuthorized', # action not authorized exception
'ValidationError', # model update validation error
'CkanCommand', # class for providing cli interfaces
'url_for', # get a ckan url for an action

## Fully defined in this file ##
'add_template_directory',
Expand All @@ -69,7 +68,6 @@ def _initialize(self):
import ckan.lib.base as base
import ckan.logic as logic
import ckan.lib.cli as cli
import ckan.lib.helpers as h

# Allow class access to these modules
self.__class__.ckan = ckan
Expand All @@ -96,8 +94,6 @@ def _initialize(self):

t['CkanCommand'] = cli.CkanCommand

t['url_for'] = h.url_for

# class functions
t['render_snippet'] = self._render_snippet
t['add_template_directory'] = self._add_template_directory
Expand Down
4 changes: 2 additions & 2 deletions ckanext/jsonpreview/tests/test_preview.py
Expand Up @@ -7,8 +7,8 @@
import ckan.model as model
import ckan.tests as tests
import ckan.plugins as plugins
import ckan.lib.helpers as h
import ckanext.jsonpreview.plugin as previewplugin
import ckan.plugins as p
from ckan.lib.create_test_data import CreateTestData
from ckan.config.middleware import make_app

Expand Down Expand Up @@ -85,7 +85,7 @@ def test_js_included(self):
assert 'data-module="jsonpreview"' in result.body, result.body

def test_iframe_is_shown(self):
url = p.toolkit.url_for(controller='package', action='resource_read', id=self.package.name, resource_id=self.resource['id'])
url = h.url_for(controller='package', action='resource_read', id=self.package.name, resource_id=self.resource['id'])
result = self.app.get(url)
assert 'data-module="data-viewer"' in result.body, result.body
assert '<iframe' in result.body, result.body
3 changes: 2 additions & 1 deletion ckanext/resourceproxy/plugin.py
@@ -1,5 +1,6 @@
from logging import getLogger

import ckan.lib.helpers as h
import ckan.plugins as p

log = getLogger(__name__)
Expand All @@ -10,7 +11,7 @@ def get_proxified_resource_url(data_dict):
:param data_dict: contains a resource and package dict
:type data_dict: dictionary
'''
url = p.toolkit.url_for(
url = h.url_for(
action='proxy_resource',
controller='ckanext.resourceproxy.controller:ProxyController',
id=data_dict['package']['name'],
Expand Down
4 changes: 0 additions & 4 deletions doc/toolkit.rst
Expand Up @@ -126,10 +126,6 @@ The following functions, classes and exceptions are provided by the toolkit.
Changed in WebHelpers 1.2: the implementation is now now a subclass of
``markupsafe.Markup``. This brings some new methods: ``.escape`` (class
method), ``.unescape``, and ``.striptags``.

**url_for** (*\*args, **kw*)
Wrapper for pylons ``routes.url_for``. Returns a URL for a defined route.



**render** (*template_name, data=None*)
Expand Down

0 comments on commit 5837ee7

Please sign in to comment.