# HG changeset patch # User Filip de Waard # Date 1293669293 -3600 # Node ID f127b973b6ce5338d2e0b80ed2788ee653e1fec4 # Parent 8c838712b684d22c87a0606981ccb09afccc737e adding routing.py back in; polished feeds.py diff -r 8c838712b684d22c87a0606981ccb09afccc737e -r f127b973b6ce5338d2e0b80ed2788ee653e1fec4 vix/config/routing.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vix/config/routing.py Thu Dec 30 01:34:53 2010 +0100 @@ -0,0 +1,34 @@ +"""Routes configuration + +The more specific and detailed routes should be defined first so they +may take precedent over the more generic routes. For more information +refer to the routes manual at http://routes.groovie.org/docs/ +""" +from routes import Mapper + +def make_map(config): + """Create, configure and return the routes Mapper""" + map = Mapper(directory=config['pylons.paths']['controllers'], + always_scan=config['debug']) + map.minimization = False + + # The ErrorController route (handles 404/500 error pages); it should + # likely stay at the top, ensuring it can always be resolved + map.connect('/error/{action}', controller='error') + map.connect('/error/{action}/{id}', controller='error') + + # Routes for 'feeds' controller + map.connect('create_feed', '/feeds', controller='feeds', + action='create', conditions=dict(method='POST')) + + map.connect('list_feeds', '/feeds', controller='feeds', + action='list', conditions=dict(method='GET')) + + # Routes for 'entries' controller + map.connect('create_entry', '/entries', controller='entries', + action='create', conditions=dict(method='POST')) + + # Routes for 'api' controller + map.connect('/api/:(action)', controller='api') + + return map diff -r 8c838712b684d22c87a0606981ccb09afccc737e -r f127b973b6ce5338d2e0b80ed2788ee653e1fec4 vix/controllers/feeds.py --- a/vix/controllers/feeds.py Thu Dec 30 01:29:28 2010 +0100 +++ b/vix/controllers/feeds.py Thu Dec 30 01:34:53 2010 +0100 @@ -28,7 +28,7 @@ from vix.lib.base import BaseController from vix.lib.decorators import authenticate -from vix.lib.auth import authorize, parse_http_authorization_header +from vix.lib.auth import authorize import vix.model as model @@ -68,7 +68,9 @@ """ + #user is already set by the authenticate decorator user = config['pylons.app_globals'].user + if not authorize(user, config['couchdb_database'], '*', 'POST'): abort(403, 'Insufficient privileges to perform action.')