flip escape order

We were double escaping commas and dashes because we escaped them
first, then escaped the % with urlencode. If we do this in the other
order we get shorter and less fragile urls.

Change-Id: I0f5f2d486c66a62469eae02d884fb31de78df803
This commit is contained in:
Sean Dague 2015-10-02 07:50:34 -04:00
parent 182c332316
commit 2070f37de4
1 changed files with 3 additions and 3 deletions

View File

@ -46,8 +46,8 @@ def generate_dashboard_url(dashboard):
baseurl = 'https://review.openstack.org/#/dashboard/?'
url = baseurl
url += urllib.urlencode({'title': escape(title),
'foreach': escape(foreach)})
url += escape(urllib.urlencode({'title': title,
'foreach': foreach}))
for section in dashboard.sections():
if not section.startswith('section'):
continue
@ -58,7 +58,7 @@ def generate_dashboard_url(dashboard):
raise ValueError("option 'query' in '%s' not set" % section)
title = section[9:-1]
encoded = urllib.urlencode({escape(title): escape(query)})
encoded = escape(urllib.urlencode({title: query}))
url += "&%s" % encoded
return url