Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP1:Update
python-yarl.19336
tests_overcome_bpo42967.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File tests_overcome_bpo42967.patch of Package python-yarl.19336
Index: yarl-1.3.0/yarl/__init__.py =================================================================== --- yarl-1.3.0.orig/yarl/__init__.py +++ yarl-1.3.0/yarl/__init__.py @@ -1,3 +1,4 @@ +import inspect import warnings from collections.abc import Mapping, Sequence from ipaddress import ip_address @@ -135,7 +136,7 @@ class URL: _PATH_UNQUOTER = _Unquoter(unsafe="+") _QS_UNQUOTER = _Unquoter(qs=True) - def __new__(cls, val="", *, encoded=False, strict=None): + def __new__(cls, val="", *, encoded=False, strict=None, separator='&'): if strict is not None: # pragma: no cover warnings.warn("strict parameter is ignored") if type(val) is cls: @@ -150,6 +151,8 @@ class URL: else: raise TypeError("Constructor parameter should be str") + cls.qs_sep = separator + if not encoded: if not val[1]: # netloc netloc = "" @@ -497,7 +500,12 @@ class URL: Empty value if URL has no query part. """ - ret = MultiDict(parse_qsl(self.raw_query_string, keep_blank_values=True)) + if 'separator' in inspect.signature(parse_qsl).parameters: + qs_dict = parse_qsl(self.raw_query_string, + keep_blank_values=True, separator=self.qs_sep) + else: + qs_dict = parse_qsl(self.raw_query_string, keep_blank_values=True) + ret = MultiDict(qs_dict) return MultiDictProxy(ret) @property @@ -890,7 +898,12 @@ class URL: def update_query(self, *args, **kwargs): """Return a new URL with query part updated.""" s = self._get_str_query(*args, **kwargs) - new_query = MultiDict(parse_qsl(s, keep_blank_values=True)) + if 'separator' in inspect.signature(parse_qsl).parameters: + qs_dict = parse_qsl(s, keep_blank_values=True, + separator=self.qs_sep) + else: + qs_dict = parse_qsl(s, keep_blank_values=True) + new_query = MultiDict(qs_dict) query = MultiDict(self.query) query.update(new_query) Index: yarl-1.3.0/tests/test_url_query.py =================================================================== --- yarl-1.3.0.orig/tests/test_url_query.py +++ yarl-1.3.0/tests/test_url_query.py @@ -63,7 +63,7 @@ def test_ampersand_as_value(): def test_semicolon_as_separator(): - u = URL("http://127.0.0.1/?a=1;b=2") + u = URL("http://127.0.0.1/?a=1;b=2", separator=';') assert len(u.query) == 2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor