# 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/>.
-from mediagoblin.routing import add_route
-add_route('mediagoblin.auth.logout',
- '/auth/logout/', 'mediagoblin.auth.views:logout')
-
-
-add_route('mediagoblin.auth.register', '/register/',
- 'mediagoblin.auth.views:register')
-
-add_route('mediagoblin.auth.login', '/login/',
- 'mediagoblin.auth.views:login')
-
-add_route('mediagoblin.auth.logout', '/logout/',
- 'mediagoblin.auth.views:logout')
-
-add_route('mediagoblin.auth.verify_email', '/verify_email/',
- 'mediagoblin.auth.views:verify_email')
-
-add_route('mediagoblin.auth.resend_verification', '/resend_verification/',
- 'mediagoblin.auth.views:resend_activation')
-
-# XXX: Does this work?
-add_route('mediagoblin.auth.resend_verification_success',
- '/resend_verification_success/',
- # template='mediagoblin/auth/resent_verification_email.html',
- 'mediagoblin.views:simple_template_render')
-
-add_route('mediagoblin.auth.forgot_password', '/forgot_password/',
- 'mediagoblin.auth.views:forgot_password')
-
-add_route('mediagoblin.auth.verify_forgot_password',
- '/forgot_password/verify/',
- 'mediagoblin.auth.views:verify_forgot_password')
+auth_routes = [
+ ('mediagoblin.auth.logout',
+ '/logout/', 'mediagoblin.auth.views:logout'),
+ ('mediagoblin.auth.register', '/register/',
+ 'mediagoblin.auth.views:register'),
+ ('mediagoblin.auth.login', '/login/',
+ 'mediagoblin.auth.views:login'),
+ ('mediagoblin.auth.logout', '/logout/',
+ 'mediagoblin.auth.views:logout'),
+ ('mediagoblin.auth.verify_email', '/verify_email/',
+ 'mediagoblin.auth.views:verify_email'),
+ ('mediagoblin.auth.resend_verification', '/resend_verification/',
+ 'mediagoblin.auth.views:resend_activation'),
+ ('mediagoblin.auth.forgot_password', '/forgot_password/',
+ 'mediagoblin.auth.views:forgot_password'),
+ ('mediagoblin.auth.verify_forgot_password',
+ '/forgot_password/verify/',
+ 'mediagoblin.auth.views:verify_forgot_password')]
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)