debianmacno-cupsweb
Last change
on this file since 973dd91 was
973dd91,
checked in by Edward Z. Yang <edwardzyang@…>, 16 years ago
|
Initial commit.
Signed-off-by: Edward Z. Yang <edwardzyang@…>
|
-
Property mode set to
100644
|
File size:
857 bytes
|
Rev | Line | |
---|
[973dd91] | 1 | from sipbmp3web.lib.base import * |
---|
| 2 | |
---|
| 3 | class TemplateController(BaseController): |
---|
| 4 | |
---|
| 5 | def view(self, url): |
---|
| 6 | """By default, the final controller tried to fulfill the request |
---|
| 7 | when no other routes match. It may be used to display a template |
---|
| 8 | when all else fails, e.g.:: |
---|
| 9 | |
---|
| 10 | def view(self, url): |
---|
| 11 | return render('/%s' % url) |
---|
| 12 | |
---|
| 13 | Or if you're using Mako and want to explicitly send a 404 (Not |
---|
| 14 | Found) response code when the requested template doesn't exist:: |
---|
| 15 | |
---|
| 16 | import mako.exceptions |
---|
| 17 | |
---|
| 18 | def view(self, url): |
---|
| 19 | try: |
---|
| 20 | return render('/%s' % url) |
---|
| 21 | except mako.exceptions.TopLevelLookupException: |
---|
| 22 | abort(404) |
---|
| 23 | |
---|
| 24 | By default this controller aborts the request with a 404 (Not |
---|
| 25 | Found) |
---|
| 26 | """ |
---|
| 27 | abort(404) |
---|
Note: See
TracBrowser
for help on using the repository browser.