aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/routing.py
diff options
context:
space:
mode:
authorChristopher Allan Webber <cwebber@dustycloud.org>2012-10-14 16:26:23 -0500
committerChristopher Allan Webber <cwebber@dustycloud.org>2012-10-14 16:26:23 -0500
commit0d857844b12b033ee8ecdbcfa474781f835bee59 (patch)
tree97c976eb804ffcac7ecf73274124d54ffee02d89 /mediagoblin/routing.py
parent1ec7ff2adbb1821c5318b4e0a18194f441d7a87e (diff)
downloadmediagoblin-0d857844b12b033ee8ecdbcfa474781f835bee59.tar.lz
mediagoblin-0d857844b12b033ee8ecdbcfa474781f835bee59.tar.xz
mediagoblin-0d857844b12b033ee8ecdbcfa474781f835bee59.zip
Added rudimentary route "mounting" w/ werkzeug routes; fixed auth routes
auth routes fixes: - mounted the auth routes at /auth/ - removed crufty old verification email route
Diffstat (limited to 'mediagoblin/routing.py')
-rw-r--r--mediagoblin/routing.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/mediagoblin/routing.py b/mediagoblin/routing.py
index 4b9c42ee..8f0f37a5 100644
--- a/mediagoblin/routing.py
+++ b/mediagoblin/routing.py
@@ -21,15 +21,28 @@ url_map = Map()
view_functions = {'index': 'mediagoblin.views:index'}
def add_route(endpoint, url, controller):
+ """
+ Add a route to the url mapping
+ """
view_functions.update({endpoint: controller})
url_map.add(Rule(url, endpoint=endpoint))
+def mount(mountpoint, routes):
+ """
+ Mount a bunch of routes to this mountpoint
+ """
+ for endpoint, url, controller in routes:
+ url = "%s/%s" % (mountpoint.rstrip('/'), url.lstrip('/'))
+ add_route(endpoint, url, controller)
+
add_route('index', '/', 'mediagoblin.views:root_view')
import mediagoblin.submit.routing
import mediagoblin.user_pages.routing
-import mediagoblin.auth.routing
import mediagoblin.edit.routing
import mediagoblin.webfinger.routing
import mediagoblin.listings.routing
+
+from mediagoblin.auth.routing import auth_routes
+mount('/auth', auth_routes)