Mercurial > p > roundup > code
comparison roundup/cgi/client.py @ 1456:745ceee35ca2
beginnings of nicer web error handling
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 20 Feb 2003 07:13:14 +0000 |
| parents | 6118d4498db3 |
| children | 378081f066cc |
comparison
equal
deleted
inserted
replaced
| 1455:436eb851045a | 1456:745ceee35ca2 |
|---|---|
| 1 # $Id: client.py,v 1.95 2003-02-18 10:58:32 richard Exp $ | 1 # $Id: client.py,v 1.96 2003-02-20 07:13:14 richard Exp $ |
| 2 | 2 |
| 3 __doc__ = """ | 3 __doc__ = """ |
| 4 WWW request handler (also used in the stand-alone server). | 4 WWW request handler (also used in the stand-alone server). |
| 5 """ | 5 """ |
| 6 | 6 |
| 13 from roundup.cgi.templating import Templates, HTMLRequest, NoTemplate | 13 from roundup.cgi.templating import Templates, HTMLRequest, NoTemplate |
| 14 from roundup.cgi import cgitb | 14 from roundup.cgi import cgitb |
| 15 | 15 |
| 16 from roundup.cgi.PageTemplates import PageTemplate | 16 from roundup.cgi.PageTemplates import PageTemplate |
| 17 | 17 |
| 18 class Unauthorised(ValueError): | 18 class HTTPException(Exception): |
| 19 pass | |
| 20 class Unauthorised(HTTPException): | |
| 21 pass | |
| 22 class NotFound(HTTPException): | |
| 23 pass | |
| 24 class Redirect(HTTPException): | |
| 25 pass | |
| 26 | |
| 27 # XXX actually _use_ FormError | |
| 28 class FormError(ValueError): | |
| 29 ''' An "expected" exception occurred during form parsing. | |
| 30 - ie. something we know can go wrong, and don't want to alarm the | |
| 31 user with | |
| 32 | |
| 33 We trap this at the user interface level and feed back a nice error | |
| 34 to the user. | |
| 35 ''' | |
| 19 pass | 36 pass |
| 20 | 37 |
| 21 class NotFound(ValueError): | |
| 22 pass | |
| 23 | |
| 24 class Redirect(Exception): | |
| 25 pass | |
| 26 | |
| 27 class SendFile(Exception): | 38 class SendFile(Exception): |
| 28 ' Sent a file from the database ' | 39 ''' Send a file from the database ''' |
| 29 | 40 |
| 30 class SendStaticFile(Exception): | 41 class SendStaticFile(Exception): |
| 31 ' Send a static file from the instance html directory ' | 42 ''' Send a static file from the instance html directory ''' |
| 32 | 43 |
| 33 def initialiseSecurity(security): | 44 def initialiseSecurity(security): |
| 34 ''' Create some Permissions and Roles on the security object | 45 ''' Create some Permissions and Roles on the security object |
| 35 | 46 |
| 36 This function is directly invoked by security.Security.__init__() | 47 This function is directly invoked by security.Security.__init__() |
