From 5b60ec41ee5d0f25d66190b2a0114a8e1b216f86 Mon Sep 17 00:00:00 2001 From: Joar Wandborg Date: Sat, 20 Oct 2012 12:09:23 +0200 Subject: [PATCH] Removed Routes dependency, added admin routes --- mediagoblin/admin/routing.py | 7 +++---- mediagoblin/plugins/api/__init__.py | 2 -- mediagoblin/plugins/flatpagesfile/__init__.py | 3 +-- mediagoblin/plugins/oauth/__init__.py | 2 -- mediagoblin/routing.py | 13 +++++++++---- setup.py | 1 - 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/mediagoblin/admin/routing.py b/mediagoblin/admin/routing.py index ea768c24..29515f12 100644 --- a/mediagoblin/admin/routing.py +++ b/mediagoblin/admin/routing.py @@ -14,8 +14,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . -from routes.route import Route - admin_routes = [ - Route('mediagoblin.admin.panel', '/panel', - controller='mediagoblin.admin.views:admin_processing_panel')] + ('mediagoblin.admin.panel', + '/panel', + 'mediagoblin.admin.views:admin_processing_panel')] diff --git a/mediagoblin/plugins/api/__init__.py b/mediagoblin/plugins/api/__init__.py index 3b7ced0c..d3fdf2ef 100644 --- a/mediagoblin/plugins/api/__init__.py +++ b/mediagoblin/plugins/api/__init__.py @@ -17,8 +17,6 @@ import os import logging -from routes.route import Route - from mediagoblin.tools import pluginapi _log = logging.getLogger(__name__) diff --git a/mediagoblin/plugins/flatpagesfile/__init__.py b/mediagoblin/plugins/flatpagesfile/__init__.py index b9b52012..3d797809 100644 --- a/mediagoblin/plugins/flatpagesfile/__init__.py +++ b/mediagoblin/plugins/flatpagesfile/__init__.py @@ -19,7 +19,6 @@ import logging import os import jinja2 -from routes.route import Route from mediagoblin.tools import pluginapi from mediagoblin.tools.response import render_to_response @@ -68,7 +67,7 @@ def setup_plugin(): name = 'flatpagesfile.%s' % name.strip() controller = flatpage_handler_builder(template) routes.append( - Route(name, url, controller=controller)) + (name, url, controller)) pluginapi.register_routes(routes) _log.info('Done setting up flatpagesfile!') diff --git a/mediagoblin/plugins/oauth/__init__.py b/mediagoblin/plugins/oauth/__init__.py index 3ed695de..4714d95d 100644 --- a/mediagoblin/plugins/oauth/__init__.py +++ b/mediagoblin/plugins/oauth/__init__.py @@ -17,8 +17,6 @@ import os import logging -from routes.route import Route - from mediagoblin.tools import pluginapi from mediagoblin.plugins.oauth.models import OAuthToken, OAuthClient, \ OAuthUserClient diff --git a/mediagoblin/routing.py b/mediagoblin/routing.py index b61a3626..defbc4ba 100644 --- a/mediagoblin/routing.py +++ b/mediagoblin/routing.py @@ -24,7 +24,10 @@ 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' + # XXX: We cannot use this, since running tests means that the plugin + # routes will be populated over and over over the same session. + # + # assert endpoint not in view_functions.keys(), 'Trying to overwrite a rule' view_functions.update({endpoint: controller}) @@ -40,11 +43,13 @@ def mount(mountpoint, routes): add_route('index', '/', 'mediagoblin.views:root_view') +from mediagoblin.admin.routing import admin_routes +from mediagoblin.auth.routing import auth_routes +mount('/auth', auth_routes) +mount('/a', admin_routes) + import mediagoblin.submit.routing import mediagoblin.user_pages.routing import mediagoblin.edit.routing import mediagoblin.webfinger.routing import mediagoblin.listings.routing - -from mediagoblin.auth.routing import auth_routes -mount('/auth', auth_routes) diff --git a/setup.py b/setup.py index 21c1179e..99584369 100644 --- a/setup.py +++ b/setup.py @@ -44,7 +44,6 @@ setup( 'setuptools', 'PasteScript', 'beaker', - 'routes', 'webob<=1.2a2,>=1.1', 'wtforms', 'py-bcrypt', -- 2.25.1