On 4/6/06, Max Ischenko <[EMAIL PROTECTED]> wrote:
>
> I run into an interesting error trying to submit a form:
>
> Traceback (most recent call last):
>   File 
> "c:\python24\lib\site-packages\cherrypy-2.2.0-py2.4.egg\cherrypy\_cphttptools.py",
>  line 104, in _run
>     applyFilters('before_main')
>   File 
> "c:\python24\lib\site-packages\cherrypy-2.2.0-py2.4.egg\cherrypy\filters\__init__.py",
>  line 151, in applyFilters
>     method()
>   File 
> "C:\Python24\lib\site-packages\cherrypy-2.2.0-py2.4.egg\cherrypy\filters\decodingfilter.py",
>  line 31, in before_main
>     self.decode(enc)
>   File 
> "C:\Python24\lib\site-packages\cherrypy-2.2.0-py2.4.egg\cherrypy\filters\decodingfilter.py",
>  line 51, in decode
>     decodedParams[key] = value.decode(enc)
> AttributeError: 'dict' object has no attribute 'decode'

Jorge Godoy reported a similar error a few days ago, but it didn't
turn out to be a problem with the filter. He mentioned the
AutoCompleteWidget, but I'm not completely clear on what the root
cause of the problem was.

The decoding filter runs *before* our decorators and, in theory,
before the NestedVariablesFilter. That means that the decoding filter
shouldn't be getting a dict from us.

> Adding print stmt showed that it tries to decode a dict for 'defaults' form 
> field, form is defined like this:
>
> spacoll_import_form = widgets.TableForm('import', submit_text='Import',
>     fields=[
>         ...
>         widgets.FieldSet('defaults', 
> template='spaca.templates.table_fieldset',
>             label='Default values',
>             fields=spacoll_default_fields()),
>     ]
> )
>
> While this is CherryPy bug and should be reported/fixed maybe TG should 
> provide its own decoding filter? Also, CherryPy folks may prefer not to fix 
> it, as having dict as a value is clearly TG-specific artifact.

I'm not sure that this is a CherryPy bug. The decoding filter pretty
reasonably expects strings to be coming in. I'm just not certain how
you're getting this error given the order of processing (CP's input
filters come before ours, so DecodingFilter should come before
NestedVariablesFilter.)

Kevin

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" 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-trunk
-~----------~----~----~----~------~----~------~--~---

Reply via email to