diff options
| author | Michael Merickel <michael@merickel.org> | 2016-02-29 10:04:57 -0600 |
|---|---|---|
| committer | Michael Merickel <michael@merickel.org> | 2016-02-29 10:04:57 -0600 |
| commit | 0c185a3f7bd717845b7e5a00bd0d7a267be582b6 (patch) | |
| tree | 610999c8fe6579c0771b9e64809f55fc9c96e9a9 /docs/tutorials/wiki2/src/authentication | |
| parent | 20eac53d0df1687be897677dfc0dd0405271faef (diff) | |
| parent | ae5cccc2bb5e749effc34f624e0abbb149fc389f (diff) | |
| download | pyramid-0c185a3f7bd717845b7e5a00bd0d7a267be582b6.tar.gz pyramid-0c185a3f7bd717845b7e5a00bd0d7a267be582b6.tar.bz2 pyramid-0c185a3f7bd717845b7e5a00bd0d7a267be582b6.zip | |
Merge pull request #2385 from stevepiercy/feature/alchemy-scaffold-update
redirect to edit page when user attempts to add page that already exists
Diffstat (limited to 'docs/tutorials/wiki2/src/authentication')
| -rw-r--r-- | docs/tutorials/wiki2/src/authentication/tutorial/views/default.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/docs/tutorials/wiki2/src/authentication/tutorial/views/default.py b/docs/tutorials/wiki2/src/authentication/tutorial/views/default.py index ffe967f6e..1b071434c 100644 --- a/docs/tutorials/wiki2/src/authentication/tutorial/views/default.py +++ b/docs/tutorials/wiki2/src/authentication/tutorial/views/default.py @@ -65,6 +65,9 @@ def add_page(request): if user is None or user.role not in ('editor', 'basic'): raise HTTPForbidden pagename = request.matchdict['pagename'] + if request.dbsession.query(Page).filter_by(name=pagename).count() > 0: + next_url = request.route_url('edit_page', pagename=pagename) + return HTTPFound(location=next_url) if 'form.submitted' in request.params: body = request.params['body'] page = Page(name=pagename, data=body) |
