Workout With Friends Stay fit with a little motivation

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Properties
error.py
Go to the documentation of this file.
1 from pyramid.httpexceptions import HTTPForbidden, HTTPFound, HTTPNotFound
2 from pyramid.view import view_config, view_defaults
3 from wowf.lib.auth import Auth
4 from wowf.views import BaseView
5
6
7 @view_defaults(context=HTTPForbidden)
8 class ForbiddenView(BaseView):
9
10 @view_config()
11 def main(self):
12 headers = None
13 if not self.request.user:
14 headers = Auth.auto_login()
15 if headers:
16 location = self.request.url
17 else:
18 location = self.request.route_url('user.login', _query={'return_to': self.request.url})
19 else:
20 location = self.request.route_url('home')
21 return HTTPFound(location=location, headers=headers)
22
23
24 @view_defaults(context=HTTPNotFound)
25 class NotFoundView(BaseView):
26
27 @view_config(renderer='error/not_found.html')
28 def main(self):
29 return dict()
30
31
32 @view_defaults(context=Exception)
33 class CatchAllView(BaseView):
34
35 @view_config(renderer='error/catch_all.html')
36 def main(self):
37 if self.settings.debug:
38 raise
39 return dict()
40