#1022: IdentityFailure Redirect - Cherrypy causes 500 error if passing compound
form values
----------------------+-----------------------------------------------------
 Reporter:  Naomi     |       Owner:  anonymous
     Type:  defect    |      Status:  new      
 Priority:  normal    |   Milestone:           
Component:  CherryPy  |     Version:  0.9a6    
 Severity:  major     |    Keywords:           
----------------------+-----------------------------------------------------
 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.

-- 
Ticket URL: <http://trac.turbogears.org/turbogears/ticket/1022>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Tickets" 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/turbogears-tickets
-~----------~----~----~----~------~----~------~--~---

Reply via email to