Ticket #359 (defect)
Opened 3 years ago
Last modified 3 years ago
AttributeError: HTTPRedirect instance has no attribute 'args'
Status: closed (fixed)
| Reported by: | dwoodruff@nngov.com | Assigned to: | fumanchu |
|---|---|---|---|
| Priority: | normal | Milestone: | 2.2-beta |
| Component: | CherryPy code | Keywords: | HTTPRedirect fails |
| Cc: |
I am issuing the following for a redirect in CP 2.1 rc2:
raise cherrypy._cperror.HTTPRedirect(url)
And receive the following:
AttributeError?: HTTPRedirect instance has no attribute 'args'
Change History
10/21/05 12:53:24: Modified by fumanchu
- owner changed from rdelon to fumanchu.
- severity changed from major to normal.
- milestone changed from 2.1-rc2 to 2.2-beta.
10/21/05 12:57:43: Modified by fumanchu
- status changed from new to assigned.
10/31/05 13:35:37: Modified by fumanchu
- status changed from assigned to closed.
- resolution set to fixed.
Fixed in [770] (trunk only).


This occurs when an instance of HTTPRedirect is coerced to a string. This can happen with str(), with print statements, or with iteration over the exception (as occurs when returning an HTTPRedirect from a handler, rather than raising it).
The HTTPRedirect exception needs to return a valid response from the first two cases. The third (return vs raise) is problematic, since it would be even *more* difficult to debug the case where a developer returns the exception instead of properly raising it.