Chris McDonough
2011-08-19 66da9b2f683ace2c0fa3ce24a607d4239c760434
coverage
4 files modified
26 ■■■■■ changed files
CHANGES.txt 2 ●●●●● patch | view | raw | blame | history
pyramid/config/__init__.py 4 ●●●● patch | view | raw | blame | history
pyramid/config/security.py 12 ●●●●● patch | view | raw | blame | history
pyramid/tests/test_config/test_views.py 8 ●●●● patch | view | raw | blame | history
CHANGES.txt
@@ -100,6 +100,8 @@
- Refactor ``pyramid.config`` into a package.
- Removed the ``_set_security_policies`` method of the Configurator.
Deprecations
------------
pyramid/config/__init__.py
@@ -16,6 +16,7 @@
from pyramid.interfaces import IExceptionResponse
from pyramid.interfaces import IDebugLogger
from pyramid.authorization import ACLAuthorizationPolicy
from pyramid.events import ApplicationCreated
from pyramid.exceptions import ConfigurationError # bw compat
from pyramid.httpexceptions import default_exceptionresponse_view
@@ -315,6 +316,9 @@
        # should be preferred rather than add-on author implementations (as
        # per automatic conflict resolution).
        if authentication_policy and not authorization_policy:
            authorization_policy = ACLAuthorizationPolicy() # default
        if authentication_policy:
            self.set_authentication_policy(authentication_policy)
        if authorization_policy:
pyramid/config/security.py
@@ -52,18 +52,6 @@
        self.registry.registerUtility(policy, IAuthorizationPolicy)
    @action_method
    def _set_security_policies(self, authentication, authorization=None):
        if (authorization is not None) and (not authentication):
            raise ConfigurationError(
                'If the "authorization" is passed a value, '
                'the "authentication" argument must also be '
                'passed a value; authorization requires authentication.')
        if authorization is None:
            authorization = ACLAuthorizationPolicy() # default
        self._set_authentication_policy(authentication)
        self._set_authorization_policy(authorization)
    @action_method
    def set_default_permission(self, permission):
        """
        Set the default permission to be used by all subsequent
pyramid/tests/test_config/test_views.py
@@ -949,7 +949,7 @@
        except HTTPForbidden, e:
            self.assertEqual(e.message,
                             'Unauthorized: <lambda> failed permission check')
        else:
        else: # pragma: no cover
            raise AssertionError
    def test_secured_view_raises_forbidden_with_name(self):
@@ -971,7 +971,7 @@
        except HTTPForbidden, e:
            self.assertEqual(e.message,
                             'Unauthorized: myview failed permission check')
        else:
        else: # pragma: no cover
            raise AssertionError
    def test_predicate_mismatch_view_has_no_name(self):
@@ -988,7 +988,7 @@
            result(None, None)
        except PredicateMismatch, e:
            self.assertEqual(e.detail, 'predicate mismatch for view <lambda>')
        else:
        else: # pragma: no cover
            raise AssertionError
    def test_predicate_mismatch_view_has_name(self):
@@ -1004,7 +1004,7 @@
            result(None, None)
        except PredicateMismatch, e:
            self.assertEqual(e.detail, 'predicate mismatch for view myview')
        else:
        else: # pragma: no cover
            raise AssertionError
            
    def test_with_predicates_all(self):