Ben Bangert wrote:
> from paste import httpexceptions
>
> def someaction(self):
>      raise httpexceptions.HTTPNotFound()
>
> For a full list of them:
> http://pythonpaste.org/module-paste.httpexceptions.html
>
> These are caught by the paste exception middleware in your
> middleware.py file.
>

And, paste has standard templates that allow you to pass custom
messages to the error document, so if you want to use those, (instead
of a custom error document), you can comment out the next to last line
in middleware.py:

# @@@ Display error documents for 401, 403, 404 status codes (if debug
is False also intercepts 500) @@@

#app = ErrorDocuments(app, global_conf, mapper=error_mapper,
**app_conf)

then something like this:
raise httpexceptions.HTTPNotFound(detail='my custom message')

will print the paste 404 error document and add your message.

davep


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to