Skip to content

Commit

Permalink
[#1797,config][s]: add ckan.webstore.enabled option with which to ena…
Browse files Browse the repository at this point in the history
…ble webstore.
  • Loading branch information
rufuspollock committed Feb 28, 2012
1 parent 4e08792 commit fd06eea
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
4 changes: 4 additions & 0 deletions ckan/config/deployment.ini_tmpl
Expand Up @@ -160,6 +160,10 @@ ckan.locale_default = en
ckan.locale_order = en de fr it es pl ru nl sv no cs_CZ hu pt_BR fi bg ca sq sr sr_Latn
ckan.locales_filtered_out = el ro lt sl

## Webstore
## Uncommment to enable webstore
# ckan.webstore.enabled = 1

## ===================================
## Extensions

Expand Down
23 changes: 13 additions & 10 deletions ckan/config/routing.py
Expand Up @@ -235,17 +235,20 @@ def make_map():
map.connect('/dataset/{id}/resource/{resource_id}',
controller='package', action="resource_read"
)
map.redirect('/dataset/{id}/resource/{resource_id}/data{url:.*?}',
'/api/resource/{resource_id}/data{url}', id=None
)
map.connect('webstore_read', '/api/resource/{id}/data{url:.*?}',
controller='webstore', action='read', url='',
conditions={'method': ['GET']}
)
map.connect('webstore_write', '/api/resource/{id}/data{url:.*?}',
controller='webstore', action='write', url='',
conditions={'method': ['PUT','POST', 'DELETE']}

## Webstore
if config.get('ckan.webstore.enabled', False):
map.redirect('/dataset/{id}/resource/{resource_id}/data{url:.*?}',
'/api/resource/{resource_id}/data{url}', id=None
)
map.connect('webstore_read', '/api/resource/{id}/data{url:.*?}',
controller='webstore', action='read', url='',
conditions={'method': ['GET']}
)
map.connect('webstore_write', '/api/resource/{id}/data{url:.*?}',
controller='webstore', action='write', url='',
conditions={'method': ['PUT','POST', 'DELETE']}
)

# group
map.redirect("/groups", "/group")
Expand Down
2 changes: 2 additions & 0 deletions test-core.ini
Expand Up @@ -59,6 +59,8 @@ ckan.mail_from = info@test.ckan.net

ckan.locale_default = en

ckan.webstore.enabled = 1

ckanext.stats.cache_enabled = 0

# Logging configuration
Expand Down

0 comments on commit fd06eea

Please sign in to comment.