Ticket #409 (closed defect: fixed)
WebOb HTTP Exceptions and PEP 352 - Required Superclass for Exceptions
| Reported by: | ac | Owned by: | maluke |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | webob | Version: | released-version |
| Severity: | normal | Keywords: | |
| Cc: |
Description
PEP 352 ( http://www.python.org/dev/peps/pep-0352/) says that exception messages should not be retrieved anymore using "exception.message" but str(exception) and the "message" attribute will be deprecated and not available in Python 3.0. This introduces an issue in WebOb? exceptions that inherit from both Response and HTTPException. The issue is that Response already implements str as (status + headerlist + body) and no message raised by an HTTP exception can be correctly retrieved/displayed. This behavior will also affect Babel messages translation for errors.
Example:
raise HTTPNotFound('"%s" could not be found' % url)
prints '404 Not Found Content-Type: text/html; charset=UTF-8 Content-Length: 0'
instead of '"/some_wrong_url" could not be found'
Can you please have a look at it, thank you.
Change History
Note: See
TracTickets for help on using
tickets.
