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 #899 (closed defect: invalid)

Opened 13 years ago

Last modified 12 years ago

turbogears.url misunderstands same-name fields from cherrypy.paramMap

Reported by: anonymous Owned by: anonymous
Priority: normal Milestone: 1.0
Component: CherryPy Version: 0.9a1
Severity: minor Keywords:


I have a login page which users get redirected to, which rebuilds the original URL using


this fails when you have e.g.


because paramMap joins these into a list {a:[4,7]} and turbogears.url encodes the list as a string, so turbogears.url produces (an escaped version of)


it looks like in turbogears/controllers.py you'd need something like

 489    for key, value in tgparams.iteritems():
           if not isinstance(value,list):
           for subvalue in value:
 490 	        if subvalue is None:
 491 	            continue
 492 	        if isinstance(subvalue, unicode):
 493 	            value = subvalue.encode("utf8")
 494 	        args.append("%s=%s" % (key, urllib.quote(str(subvalue))))

that's probably bad programming but you get the idea. I haven't experimented with what cherrypy.paramMap does in more obscure cases.

Change History

comment:1 Changed 13 years ago by jorge.vargas

  • Milestone set to 1.0

can someone confirm or deny this?

comment:2 Changed 13 years ago by fumanchu@…

You should probably be passing and using cherrypy.request.query_string instead of paramMap, both to avoid the list bug, and because the latter also includes both GET and POST params. If there's good reason to include the POST (request-body) params, I'd like to know it :) so it can be provided in the new cherrypy.url() function in CP 3.

comment:3 Changed 13 years ago by jorge.vargas

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

not a bug just bad usage.

Note: See TracTickets for help on using tickets.