- Be more tolerant of potential error conditions in ``match_param`` and
``physical_path`` predicate implementations; instead of raising an exception,
return False.
| | |
| | | attribute of the request. It no longer fails in this case. See |
| | | https://github.com/Pylons/pyramid/issues/700 |
| | | |
| | | - Be more tolerant of potential error conditions in ``match_param`` and |
| | | ``physical_path`` predicate implementations; instead of raising an exception, |
| | | return False. |
| | | |
| | | Deprecations |
| | | ------------ |
| | | |
| | |
| | | |
| | | from .util import as_sorted_tuple |
| | | |
| | | _marker = object() |
| | | |
| | | class XHRPredicate(object): |
| | | def __init__(self, val, config): |
| | | self.val = bool(val) |
| | |
| | | phash = text |
| | | |
| | | def __call__(self, context, request): |
| | | if not request.matchdict: |
| | | # might be None |
| | | return False |
| | | for k, v in self.reqs: |
| | | if request.matchdict.get(k) != v: |
| | | return False |
| | |
| | | phash = text |
| | | |
| | | def __call__(self, context, request): |
| | | return resource_path_tuple(context) == self.val |
| | | if getattr(context, '__name__', _marker) is not _marker: |
| | | return resource_path_tuple(context) == self.val |
| | | return False |
| | | |
| | | class EffectivePrincipalsPredicate(object): |
| | | def __init__(self, val, config): |
| | |
| | | result = inst(None, request) |
| | | self.assertFalse(result) |
| | | |
| | | def test___call___matchdict_is_None(self): |
| | | inst = self._makeOne('abc=1') |
| | | request = Dummy() |
| | | request.matchdict = None |
| | | result = inst(None, request) |
| | | self.assertFalse(result) |
| | | |
| | | def test_text(self): |
| | | inst = self._makeOne(('def= 1', 'abc =2')) |
| | | self.assertEqual(inst.text(), 'match_param abc=2,def=1') |
| | |
| | | context.__parent__ = root |
| | | self.assertFalse(inst(context, None)) |
| | | |
| | | def test_it_call_context_has_no_name(self): |
| | | inst = self._makeOne('/', None) |
| | | context = Dummy() |
| | | self.assertFalse(inst(context, None)) |
| | | |
| | | class Test_EffectivePrincipalsPredicate(unittest.TestCase): |
| | | def setUp(self): |
| | | self.config = testing.setUp() |