Search code examples
pythontornado

Tornado reverse_url encodes 'special characters' like ? and &


I'm new to Tornado and I have a problem :

href='{{ reverse_url("web-html","list-builds?bundle_identifier=" + app.bundle_identifier+ "&app_name=" + (app.name)) }}'

outputs:

//list-builds%3Fbundle_identifier%3Dcom.redflagdeals.rfd2%26app_name%3DRFD2

while I want something like :

//list-builds?bundle_identifier=com.redflagdeals.rfd2&app_name=RFD2

What am I missing ? Thanks

P.S : Mac OS X 10.9, Python 2.7, Tornado 4.0.X


Solution

  • Use reverse_url to construct the base url, and then add query parameters afterwards. {{ reverse_url("web-html", "list-builds") + "?" + urlencode(dict(bundle_identifier=app.bundle_identifier)) }}