diff options
| author | Timur Izhbulatov <timochka@gmail.com> | 2015-04-14 08:42:05 +0400 |
|---|---|---|
| committer | Timur Izhbulatov <timochka@gmail.com> | 2015-04-14 08:42:05 +0400 |
| commit | afa8a7457384aeb2c621b65f3acccce1ec28c3b9 (patch) | |
| tree | 78e8a1d2503e703e7fef8ebe653c550ee861c3d5 | |
| parent | 00f80cd6d2301720792b6448909aaed3895821e7 (diff) | |
| download | pyramid-afa8a7457384aeb2c621b65f3acccce1ec28c3b9.tar.gz pyramid-afa8a7457384aeb2c621b65f3acccce1ec28c3b9.tar.bz2 pyramid-afa8a7457384aeb2c621b65f3acccce1ec28c3b9.zip | |
Request params starting with '=' may have value
| -rw-r--r-- | pyramid/config/predicates.py | 7 | ||||
| -rw-r--r-- | pyramid/tests/test_config/test_predicates.py | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/pyramid/config/predicates.py b/pyramid/config/predicates.py index fbd214b15..d87fd1aae 100644 --- a/pyramid/config/predicates.py +++ b/pyramid/config/predicates.py @@ -70,8 +70,11 @@ class RequestParamPredicate(object): for p in val: k = p v = None - if '=' in p and not p.startswith('='): - k, v = p.split('=', 1) + if '=' in p: + if p.startswith('='): + k, v = p.rsplit('=', 1) + else: + k, v = p.split('=', 1) k, v = k.strip(), v.strip() reqs.append((k, v)) self.val = val diff --git a/pyramid/tests/test_config/test_predicates.py b/pyramid/tests/test_config/test_predicates.py index 46516f518..ee24de093 100644 --- a/pyramid/tests/test_config/test_predicates.py +++ b/pyramid/tests/test_config/test_predicates.py @@ -157,8 +157,8 @@ class TestRequestParamPredicate(unittest.TestCase): self.assertEqual(inst.text(), 'request_param abc=1,def') def test_text_multi_equal_sign(self): - inst = self._makeOne(('abc= 1', '=def')) - self.assertEqual(inst.text(), 'request_param =def,abc=1') + inst = self._makeOne(('abc= 1', '=def= 2')) + self.assertEqual(inst.text(), 'request_param =def=2,abc=1') def test_phash_exists(self): inst = self._makeOne('abc') |
