Ticket #1022 (closed defect: fixed)
IdentityFailure Redirect - Cherrypy causes 500 error if passing compound form values
|Reported by:||Naomi||Owned by:||anonymous|
If a form is submitted after an identity has timed out, IdentityFailure uses cherrypy.InternalRedirect to redirect to identity.failure_url. If the submitted form had compound form values (such as person.firstname and person.lastname), Cherrypy throws the following internal error:
Traceback (most recent call last): File "/turbogears/thirdparty/cherrypy/cherrypy/_cphttptools.py", line 104, in _run applyFilters('before_main') File "/turbogears/thirdparty/cherrypy/cherrypy/filters/__init__.py", line 151, in applyFilters method() File "/turbogears/thirdparty/cherrypy/cherrypy/filters/decodingfilter.py", line 31, in before_main self.decode(enc) File "/turbogears/thirdparty/cherrypy/cherrypy/filters/decodingfilter.py", line 50, in decode decodedParams[key] = value.decode(enc) AttributeError: 'dict' object has no attribute 'decode'
The problem occurs in the following chunk of code from cherrypy/_cphttptools.py:
# Loop to allow for InternalRedirect. while True: try: applyFilters('before_main') if self.execute_main: self.main() break except cherrypy.InternalRedirect, ir: self.object_path = ir.path
_cphttptools.py calls applyFilters('before_main') twice: once before the redirect, and once after. The first time through, applyFilters converts the compound form values to dictionaries. The second time through, cherrypy/filters/decodingfilter.py dies because it tries to decode a dictionary.
This should be an easy fix: either only call applyFilters('before_main') the first time, or put a check into decodingfilter.py to make sure you're not trying to decode a dictionary.
- Component changed from CherryPy to Identity
- Milestone set to 1.0
- Status changed from new to closed
- Resolution set to invalid
- Status changed from closed to reopened
- Resolution invalid deleted
- Component changed from Identity to TurboGears
- Status changed from reopened to closed
- Resolution set to fixed