From d56e82635f85f7a8a7d184a3eae539c09a7b001d Mon Sep 17 00:00:00 2001 From: Joar Wandborg Date: Mon, 15 Oct 2012 00:12:58 +0200 Subject: [PATCH] Fixed OAuth access_token duplicate route Changed route name to "[...]list_connections" --- mediagoblin/app.py | 1 + mediagoblin/auth/routing.py | 2 -- mediagoblin/plugins/api/__init__.py | 9 ++++++--- mediagoblin/plugins/oauth/__init__.py | 11 +++++++---- mediagoblin/routing.py | 4 +++- mediagoblin/tools/pluginapi.py | 1 + 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/mediagoblin/app.py b/mediagoblin/app.py index 8a19b3e0..3a2d00f0 100644 --- a/mediagoblin/app.py +++ b/mediagoblin/app.py @@ -93,6 +93,7 @@ class MediaGoblinApp(object): self.url_map = url_map for route in PluginManager().get_routes(): + _log.debug('adding plugin route: {0}'.format(route)) add_route(*route) # set up staticdirector tool diff --git a/mediagoblin/auth/routing.py b/mediagoblin/auth/routing.py index 145761ea..2a6abb47 100644 --- a/mediagoblin/auth/routing.py +++ b/mediagoblin/auth/routing.py @@ -16,8 +16,6 @@ auth_routes = [ - ('mediagoblin.auth.logout', - '/logout/', 'mediagoblin.auth.views:logout'), ('mediagoblin.auth.register', '/register/', 'mediagoblin.auth.views:register'), ('mediagoblin.auth.login', '/login/', diff --git a/mediagoblin/plugins/api/__init__.py b/mediagoblin/plugins/api/__init__.py index f370cca6..3b7ced0c 100644 --- a/mediagoblin/plugins/api/__init__.py +++ b/mediagoblin/plugins/api/__init__.py @@ -33,11 +33,14 @@ def setup_plugin(): _log.debug('API config: {0}'.format(config)) routes = [ - ('mediagoblin.plugins.api.test', '/api/test', + ('mediagoblin.plugins.api.test', + '/api/test', 'mediagoblin.plugins.api.views:api_test'), - ('mediagoblin.plugins.api.entries', '/api/entries', + ('mediagoblin.plugins.api.entries', + '/api/entries', 'mediagoblin.plugins.api.views:get_entries'), - ('mediagoblin.plugins.api.post_entry', '/api/submit', + ('mediagoblin.plugins.api.post_entry', + '/api/submit', 'mediagoblin.plugins.api.views:post_entry')] pluginapi.register_routes(routes) diff --git a/mediagoblin/plugins/oauth/__init__.py b/mediagoblin/plugins/oauth/__init__.py index 64acf0e7..3ed695de 100644 --- a/mediagoblin/plugins/oauth/__init__.py +++ b/mediagoblin/plugins/oauth/__init__.py @@ -36,13 +36,16 @@ def setup_plugin(): _log.debug('OAuth config: {0}'.format(config)) routes = [ - ('mediagoblin.plugins.oauth.authorize', '/oauth/authorize', + ('mediagoblin.plugins.oauth.authorize', + '/oauth/authorize', 'mediagoblin.plugins.oauth.views:authorize'), - ('mediagoblin.plugins.oauth.authorize_client', '/oauth/client/authorize', + ('mediagoblin.plugins.oauth.authorize_client', + '/oauth/client/authorize', 'mediagoblin.plugins.oauth.views:authorize_client'), - ('mediagoblin.plugins.oauth.access_token', '/oauth/access_token', - 'mediagoblin.plugins.oauth.views:access_token'), ('mediagoblin.plugins.oauth.access_token', + '/oauth/access_token', + 'mediagoblin.plugins.oauth.views:access_token'), + ('mediagoblin.plugins.oauth.list_connections', '/oauth/client/connections', 'mediagoblin.plugins.oauth.views:list_connections'), ('mediagoblin.plugins.oauth.register_client', diff --git a/mediagoblin/routing.py b/mediagoblin/routing.py index 8f0f37a5..b61a3626 100644 --- a/mediagoblin/routing.py +++ b/mediagoblin/routing.py @@ -18,12 +18,14 @@ from werkzeug.routing import Map, Rule url_map = Map() -view_functions = {'index': 'mediagoblin.views:index'} +view_functions = {} def add_route(endpoint, url, controller): """ Add a route to the url mapping """ + #assert endpoint not in view_functions.keys(), 'Trying to overwrite a rule' + view_functions.update({endpoint: controller}) url_map.add(Rule(url, endpoint=endpoint)) diff --git a/mediagoblin/tools/pluginapi.py b/mediagoblin/tools/pluginapi.py index df3f51c4..1752dfc8 100644 --- a/mediagoblin/tools/pluginapi.py +++ b/mediagoblin/tools/pluginapi.py @@ -125,6 +125,7 @@ class PluginManager(object): def register_route(self, route): """Registers a single route""" + _log.debug('registering route: {0}'.format(route)) self.routes.append(route) def get_routes(self): -- 2.25.1