summaryrefslogtreecommitdiff
path: root/docs/tutorials/wiki2/src/authorization
diff options
context:
space:
mode:
Diffstat (limited to 'docs/tutorials/wiki2/src/authorization')
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/routes.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/routes.py b/docs/tutorials/wiki2/src/authorization/tutorial/routes.py
index c7c3a2120..f0a8b7f96 100644
--- a/docs/tutorials/wiki2/src/authorization/tutorial/routes.py
+++ b/docs/tutorials/wiki2/src/authorization/tutorial/routes.py
@@ -1,4 +1,7 @@
-from pyramid.httpexceptions import HTTPNotFound
+from pyramid.httpexceptions import (
+ HTTPNotFound,
+ HTTPFound,
+)
from pyramid.security import (
Allow,
Everyone,
@@ -19,6 +22,9 @@ def includeme(config):
def new_page_factory(request):
pagename = request.matchdict['pagename']
+ if request.dbsession.query(Page).filter_by(name=pagename).count() > 0:
+ next_url = request.route_url('edit_page', pagename=pagename)
+ raise HTTPFound(location=next_url)
return NewPage(pagename)
class NewPage(object):