Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1622 (closed defect: fixed)

Opened 9 years ago

Last modified 9 years ago

VisitFilter breaks when request has list parameters

Reported by: roger.demetrescu Owned by: roger.demetrescu
Priority: high Milestone: 1.0.4
Component: TurboGears Version: 1.0.4b3
Severity: major Keywords:
Cc:

Description

r3771 breaks calls to exposed methods when Identity is on and there are repeated parameters (aka list parameters), like:

 http://localhost:8080/test?foo=1&foo=2

Here is the traceback:

Traceback (most recent call last):
  File "c:\python25\lib\site-packages\cherrypy-2.2.1-py2.5.egg\cherrypy\_cphttptools.py", line 103, in _run
    applyFilters('before_main')
  File "c:\python25\lib\site-packages\cherrypy-2.2.1-py2.5.egg\cherrypy\filters\__init__.py", line 151, in applyFilters
    method()
  File "c:\turbogears1.0\turbogears\visit\api.py", line 223, in before_main
    cherrypy.request.params = encode_utf8(cherrypy.request.params)
  File "c:\turbogears1.0\turbogears\visit\api.py", line 184, in encode_utf8
    res[k] = encode_utf8(v)
  File "c:\turbogears1.0\turbogears\visit\api.py", line 187, in encode_utf8
    res[k] = v.encode('utf-8')
AttributeError: 'list' object has no attribute 'encode'

Change History

comment:1 Changed 9 years ago by roger.demetrescu

  • Status changed from new to closed
  • Resolution set to fixed

Fixed in r3807.

comment:2 Changed 9 years ago by chrisz

As discussed on the mailing list, this fix was still not complete. For instance it did not handle the case of a list of dicts (url?a-1.b=1&a-2.b=2).

The fix in r3817 should now really handle all cases. I have also added a better unit test that does not only test that we don't break anything completely, but also checks whether the encoding works correctly.

Note: See TracTickets for help on using tickets.