Issue #1158 wontfix

dicts in query strings are not evaluated

Anonymous created an issue

GET /foo?foo[1]=bar&foo[blah]=bar

@cherrypy.expose('foo') def index(**kw): print kw

expected output: {'foo': {u'1': u'bar', u'blah': u'bar'}} actual result: {'foo[1]': u'bar', 'foo[blah]': u'bar'}

Comments (4)

  1. Neo Mofoka

    I don't think that's standard behaviour for URL arguments. I think you'd have to write your own code inside the controller that would unpack the dictionaries for you manually. So...something like:

    def foo(*path, **args):
        for arg in args:
            locals()[arg] = args[arg]
        # Rest of controller code here can use dictionary in local scope
  2. Joel Rivera

    I don't see any support from the cherrypy community to this kind of qs parsing/argument handling, I think is a won't fix for now. As an alternative you could write your own Dispatcher to implement this specific feature and it will be great if you could share that later on pypi.

  3. Log in to comment