(`code_generator_class` and `context_class`) (pull request ``#404``).
- added support for context/environment/evalctx decorator functions on
the finalize callback of the environment.
+- escape query strings for urlencode properly. Previously slashes were not
+ escaped in that place.
Version 2.7.3
-------------
if itemiter is None:
return unicode_urlencode(value)
return u'&'.join(unicode_urlencode(k) + '=' +
- unicode_urlencode(v) for k, v in itemiter)
+ unicode_urlencode(v, for_qs=True)
+ for k, v in itemiter)
@evalcontextfilter
return Markup(u'\n'.join(u'<p>%s</p>' % escape(x) for x in result))
-def unicode_urlencode(obj, charset='utf-8'):
+def unicode_urlencode(obj, charset='utf-8', for_qs=False):
"""URL escapes a single bytestring or unicode string with the
given charset if applicable to URL safe quoting under all rules
that need to be considered under all supported Python versions.
obj = text_type(obj)
if isinstance(obj, text_type):
obj = obj.encode(charset)
- return text_type(url_quote(obj))
+ safe = for_qs and b'' or b'/'
+ rv = text_type(url_quote(obj, safe))
+ if for_qs:
+ rv = rv.replace('%20', '+')
+ return rv
class LRUCache(object):