diff options
| -rw-r--r-- | CONTRIBUTORS.txt | 2 | ||||
| -rw-r--r-- | pyramid/config/predicates.py | 5 | ||||
| -rw-r--r-- | pyramid/tests/test_config/test_predicates.py | 12 |
3 files changed, 18 insertions, 1 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 7c895ac15..db069247a 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -247,6 +247,8 @@ Contributors - Donald Stufft, 2015/03/15 +- Timur Izhbulatov, 2015/04/14 + - Karen Dalton, 2015/06/01 - Igor Stroh, 2015/06/10 diff --git a/pyramid/config/predicates.py b/pyramid/config/predicates.py index 967f2eeee..d87fd1aae 100644 --- a/pyramid/config/predicates.py +++ b/pyramid/config/predicates.py @@ -71,7 +71,10 @@ class RequestParamPredicate(object): k = p v = None if '=' in p: - k, v = p.split('=', 1) + 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 1cd6050bf..ee24de093 100644 --- a/pyramid/tests/test_config/test_predicates.py +++ b/pyramid/tests/test_config/test_predicates.py @@ -144,6 +144,10 @@ class TestRequestParamPredicate(unittest.TestCase): inst = self._makeOne('abc') self.assertEqual(inst.text(), 'request_param abc') + def test_text_exists_equal_sign(self): + inst = self._makeOne('=abc') + self.assertEqual(inst.text(), 'request_param =abc') + def test_text_withval(self): inst = self._makeOne('abc= 1') self.assertEqual(inst.text(), 'request_param abc=1') @@ -152,10 +156,18 @@ class TestRequestParamPredicate(unittest.TestCase): inst = self._makeOne(('abc= 1', 'def')) self.assertEqual(inst.text(), 'request_param abc=1,def') + def test_text_multi_equal_sign(self): + 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') self.assertEqual(inst.phash(), 'request_param abc') + def test_phash_exists_equal_sign(self): + inst = self._makeOne('=abc') + self.assertEqual(inst.phash(), 'request_param =abc') + def test_phash_withval(self): inst = self._makeOne('abc= 1') self.assertEqual(inst.phash(), "request_param abc=1") |
