mirror of
https://github.com/wassname/pyramid_formalchemy.git
synced 2026-08-11 11:23:53 +08:00
add a redirect route
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from pyramid.httpexceptions import HTTPFound
|
||||
|
||||
def includeme(config):
|
||||
"""include formalchemy's zcml"""
|
||||
@@ -39,6 +40,11 @@ def formalchemy_admin(config, route_name,
|
||||
|
||||
factory = type('%s_%s' % (factory.__name__, route_name), (factory,), factory_args)
|
||||
|
||||
def redirect(request):
|
||||
return HTTPFound(location='%s/%s/' % (request.application_url, route_name))
|
||||
|
||||
config.add_route('%s_redirect' % route_name, route_name, redirect)
|
||||
|
||||
config.add_route(route_name, '%s/*traverse' % route_name,
|
||||
factory=factory)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user