Skip to content

Commit

Permalink
minor routing cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Feb 28, 2012
1 parent aa0129d commit c6834aa
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions ckan/config/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def make_map():
DELETE = dict(method=['DELETE'])
GET_POST = dict(method=['GET', 'POST'])
PUT_POST = dict(method=['PUT','POST'])
OPTIONS = dict(method=['OPTIONS'])

from lib.plugins import register_package_plugins
from lib.plugins import register_group_plugins
Expand All @@ -39,7 +40,7 @@ def make_map():
map.connect('/error/{action}', controller='error')
map.connect('/error/{action}/{id}', controller='error')

map.connect('*url', controller='home', action='cors_options', conditions=dict(method=['OPTIONS']))
map.connect('*url', controller='home', action='cors_options', conditions=OPTIONS)

# CUSTOM ROUTES HERE
for plugin in routing_plugins:
Expand Down Expand Up @@ -84,18 +85,12 @@ def make_map():
with SubMapper(map, controller='api', path_prefix='/api{ver:/1|/2|}', ver='/1',
requirements=dict(register=register_list_str)) as m:

m.connect('/rest/{register}', action='list',
conditions=GET)
m.connect('/rest/{register}', action='create',
conditions=POST)
m.connect('/rest/{register}/{id}', action='show',
conditions=GET)
m.connect('/rest/{register}/{id}', action='update',
conditions=PUT)
m.connect('/rest/{register}/{id}', action='update',
conditions=POST)
m.connect('/rest/{register}/{id}', action='delete',
conditions=DELETE)
m.connect('/rest/{register}', action='list', conditions=GET)
m.connect('/rest/{register}', action='create', conditions=POST)
m.connect('/rest/{register}/{id}', action='show', conditions=GET)
m.connect('/rest/{register}/{id}', action='update', conditions=PUT)
m.connect('/rest/{register}/{id}', action='update', conditions=POST)
m.connect('/rest/{register}/{id}', action='delete', conditions=DELETE)
m.connect('/rest/{register}/{id}/:subregister', action='list',
conditions=GET)
m.connect('/rest/{register}/{id}/:subregister', action='create',
Expand Down

0 comments on commit c6834aa

Please sign in to comment.