diff options
| author | Chris McDonough <chrism@agendaless.com> | 2010-09-07 20:27:17 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2010-09-07 20:27:17 +0000 |
| commit | a58c4a4968053314be39aae62eed3c7a9c863e40 (patch) | |
| tree | b3bb42fa59ed926e10a9e81cdd57734afb81fe66 /repoze/bfg/tests/test_configuration.py | |
| parent | 6b9e366a4d6d0ac6a0424646e3d2ba32850371b8 (diff) | |
| download | pyramid-a58c4a4968053314be39aae62eed3c7a9c863e40.tar.gz pyramid-a58c4a4968053314be39aae62eed3c7a9c863e40.tar.bz2 pyramid-a58c4a4968053314be39aae62eed3c7a9c863e40.zip | |
- Use ``hash()`` rather than ``id()`` when computing the "phash" of a
custom route/view predicate in order to allow the custom predicate
some control over which predicates are "equal".
- Use ``response.headerlist.append`` instead of
``response.headers.add`` in
``repoze.bfg.request.add_global_response_headers`` in case the
response is not a WebOb response.
Diffstat (limited to 'repoze/bfg/tests/test_configuration.py')
| -rw-r--r-- | repoze/bfg/tests/test_configuration.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/repoze/bfg/tests/test_configuration.py b/repoze/bfg/tests/test_configuration.py index 232cbd6bb..1ee2c1018 100644 --- a/repoze/bfg/tests/test_configuration.py +++ b/repoze/bfg/tests/test_configuration.py @@ -3392,6 +3392,16 @@ class Test__make_predicates(unittest.TestCase): ) self.failUnless(order1 > order2) + def test_different_custom_predicates_with_same_hash(self): + class PredicateWithHash(object): + def __hash__(self): + return 1 + a = PredicateWithHash() + b = PredicateWithHash() + _, _, a_phash = self._callFUT(custom=(a,)) + _, _, b_phash = self._callFUT(custom=(b,)) + self.assertEqual(a_phash, b_phash) + def test_traverse_has_remainder_already(self): order, predicates, phash = self._callFUT(traverse='/1/:a/:b') self.assertEqual(len(predicates), 1) |
