Removed Routes dependency, added admin routes

This commit is contained in:
Joar Wandborg 2012-10-20 12:09:23 +02:00
parent 54397b9063
commit 5b60ec41ee
6 changed files with 13 additions and 15 deletions

View File

@ -14,8 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from routes.route import Route
admin_routes = [ admin_routes = [
Route('mediagoblin.admin.panel', '/panel', ('mediagoblin.admin.panel',
controller='mediagoblin.admin.views:admin_processing_panel')] '/panel',
'mediagoblin.admin.views:admin_processing_panel')]

View File

@ -17,8 +17,6 @@
import os import os
import logging import logging
from routes.route import Route
from mediagoblin.tools import pluginapi from mediagoblin.tools import pluginapi
_log = logging.getLogger(__name__) _log = logging.getLogger(__name__)

View File

@ -19,7 +19,6 @@ import logging
import os import os
import jinja2 import jinja2
from routes.route import Route
from mediagoblin.tools import pluginapi from mediagoblin.tools import pluginapi
from mediagoblin.tools.response import render_to_response from mediagoblin.tools.response import render_to_response
@ -68,7 +67,7 @@ def setup_plugin():
name = 'flatpagesfile.%s' % name.strip() name = 'flatpagesfile.%s' % name.strip()
controller = flatpage_handler_builder(template) controller = flatpage_handler_builder(template)
routes.append( routes.append(
Route(name, url, controller=controller)) (name, url, controller))
pluginapi.register_routes(routes) pluginapi.register_routes(routes)
_log.info('Done setting up flatpagesfile!') _log.info('Done setting up flatpagesfile!')

View File

@ -17,8 +17,6 @@
import os import os
import logging import logging
from routes.route import Route
from mediagoblin.tools import pluginapi from mediagoblin.tools import pluginapi
from mediagoblin.plugins.oauth.models import OAuthToken, OAuthClient, \ from mediagoblin.plugins.oauth.models import OAuthToken, OAuthClient, \
OAuthUserClient OAuthUserClient

View File

@ -24,7 +24,10 @@ def add_route(endpoint, url, controller):
""" """
Add a route to the url mapping 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}) view_functions.update({endpoint: controller})
@ -40,11 +43,13 @@ def mount(mountpoint, routes):
add_route('index', '/', 'mediagoblin.views:root_view') 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.submit.routing
import mediagoblin.user_pages.routing import mediagoblin.user_pages.routing
import mediagoblin.edit.routing import mediagoblin.edit.routing
import mediagoblin.webfinger.routing import mediagoblin.webfinger.routing
import mediagoblin.listings.routing import mediagoblin.listings.routing
from mediagoblin.auth.routing import auth_routes
mount('/auth', auth_routes)

View File

@ -44,7 +44,6 @@ setup(
'setuptools', 'setuptools',
'PasteScript', 'PasteScript',
'beaker', 'beaker',
'routes',
'webob<=1.2a2,>=1.1', 'webob<=1.2a2,>=1.1',
'wtforms', 'wtforms',
'py-bcrypt', 'py-bcrypt',