Skip to content

Commit

Permalink
Updated the routing for packages and trying (failed) to check whether…
Browse files Browse the repository at this point in the history
… the new route already exists or not
  • Loading branch information
rossjones committed Jan 3, 2012
1 parent d4f4bd7 commit 4d20d50
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 7 additions & 3 deletions ckan/controllers/group.py
Expand Up @@ -42,9 +42,13 @@ def register_pluggable_behaviour(map):
_default_controller_behaviour = plugin

for group_type in plugin.group_types():
# Create the routes based on group_type here.....
map.connect('/%s/new' % (group_type,), controller='group', action='new')
map.connect('%s_read' % (group_type,), '/%s/{id}' % (group_type,), controller='group', action='read')
# Create the routes based on group_type here, this will allow us to have top level
# objects that are actually Groups, but first we need to make sure we are not
# clobbering an existing domain
map.connect('%s_new' % (group_type,),
'/%s/new' % (group_type,), controller='group', action='new')
map.connect('%s_read' % (group_type,),
'/%s/{id}' % (group_type,), controller='group', action='read')
map.connect('%s_action' % (group_type,),
'/%s/{action}/{id}' % (group_type,), controller='group',
requirements=dict(action='|'.join(['edit', 'authz', 'history' ]))
Expand Down
8 changes: 7 additions & 1 deletion ckan/controllers/package.py
Expand Up @@ -66,7 +66,7 @@ def register_pluggable_behaviour(map):
exception will be raised.
"""
global _default_controller_behaviour

# Check this method hasn't been invoked already.
# TODO: This method seems to be being invoked more than once during running of
# the tests. So I've disbabled this check until I figure out why.
Expand All @@ -84,7 +84,13 @@ def register_pluggable_behaviour(map):

for package_type in plugin.package_types():
# Create a connection between the newly named type and the package controller
# but first we need to make sure we are not clobbering an existing domain
map.connect('/%s/new' % (package_type,), controller='package', action='new')
map.connect('%s_read' % (package_type,), '/%s/{id}' % (package_type,), controller='package', action='read')
map.connect('%s_action' % (package_type,),
'/%s/{action}/{id}' % (package_type,), controller='package',
requirements=dict(action='|'.join(['edit', 'authz', 'history' ]))
)

if package_type in _controller_behaviour_for:
raise ValueError, "An existing IDatasetForm is "\
Expand Down

0 comments on commit 4d20d50

Please sign in to comment.