Fixed issue in :class:`.URL` object where stringifying the object
would not URL encode special characters, preventing the URL from being
re-consumable as a real URL. Pull request courtesy Miguel Grinberg.
Fixes: #5341
Closes: #5342
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/5342
Pull-request-sha:
362ca3398336a3a892e8020530f0c68d4f2d1d01
Change-Id: Ief6218122d1ec0c70479eb1a90e1c16433801924
(cherry picked from commit
2644693c0bf5b775f7a7283cdbf566a37872586f)
--- /dev/null
+.. change::
+ :tags: bug, engine
+ :tickets: 5341
+
+ Fixed issue in :class:`.URL` object where stringifying the object
+ would not URL encode special characters, preventing the URL from being
+ re-consumable as a real URL. Pull request courtesy Miguel Grinberg.
\ No newline at end of file
keys = list(self.query)
keys.sort()
s += "?" + "&".join(
- "%s=%s" % (k, element)
+ "%s=%s" % (util.quote_plus(k), util.quote_plus(element))
for k in keys
for element in util.to_list(self.query[k])
)
"dialect://user:pass@host/db?arg1=param1&arg2=param2&arg2=param3",
)
+ test_url = "dialect://user:pass@host/db?arg1%3D=param1&arg2=param+2"
+ u = url.make_url(test_url)
+ eq_(u.query, {"arg1=": "param1", "arg2": "param 2"})
+ eq_(str(u), test_url)
+
def test_comparison(self):
components = (
"drivername",