diff options
| author | Chris McDonough <chrism@plope.com> | 2013-10-30 20:24:34 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2013-10-30 20:24:34 -0400 |
| commit | 675e0d4cf01840740490c03a2e3704b0b7d98de3 (patch) | |
| tree | fd361219eba20d57acdf5887dac35347de1fe14f /docs/quick_tutorial/authentication/tutorial | |
| parent | a91c19837f5ce579ce2a5bf68ddee30cfaebe034 (diff) | |
| download | pyramid-675e0d4cf01840740490c03a2e3704b0b7d98de3.tar.gz pyramid-675e0d4cf01840740490c03a2e3704b0b7d98de3.tar.bz2 pyramid-675e0d4cf01840740490c03a2e3704b0b7d98de3.zip | |
convert remember/forget to request-method-based
Diffstat (limited to 'docs/quick_tutorial/authentication/tutorial')
| -rw-r--r-- | docs/quick_tutorial/authentication/tutorial/views.py | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/docs/quick_tutorial/authentication/tutorial/views.py b/docs/quick_tutorial/authentication/tutorial/views.py index 3038b6d9b..240a23d3e 100644 --- a/docs/quick_tutorial/authentication/tutorial/views.py +++ b/docs/quick_tutorial/authentication/tutorial/views.py @@ -1,9 +1,4 @@ from pyramid.httpexceptions import HTTPFound -from pyramid.security import ( - remember, - forget, - authenticated_userid - ) from pyramid.view import ( view_config, view_defaults @@ -16,7 +11,7 @@ from .security import USERS class TutorialViews: def __init__(self, request): self.request = request - self.logged_in = authenticated_userid(request) + self.logged_in = request.authenticated_userid @view_config(route_name='home') def home(self): @@ -41,9 +36,8 @@ class TutorialViews: login = request.params['login'] password = request.params['password'] if USERS.get(login) == password: - headers = remember(request, login) - return HTTPFound(location=came_from, - headers=headers) + request.remember_userid(login) + return HTTPFound(location=came_from) message = 'Failed login' return dict( @@ -58,7 +52,6 @@ class TutorialViews: @view_config(route_name='logout') def logout(self): request = self.request - headers = forget(request) + request.forget_userid() url = request.route_url('home') - return HTTPFound(location=url, - headers=headers) + return HTTPFound(location=url) |
