Hi,
What is the best way to raise 403 (i.e. displaying the Not Authorized
error page to the user) from within traversal, when the Forbidden
context is already used to show the login view?
Right now, I try to add some extra code to the beginning of the login
view:
def login(context, request):
referrer = request.url
login_url = request.route_url('login')
if authenticated_userid(request) is not None:
if referrer == login_url:
return Response('You have already logged in')
else:
# This is for Forbidden raised in traversal.
return Response('Not Authorized', status=403)
# continue with the login form
...
but it doesn't feel right. Plus, this ad hoc 403 page looks different
than those created by pyramid.httpexceptions. How can I make it better?
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.