pyramid/config/__init__.py | ●●●●● patch | view | raw | blame | history | |
pyramid/config/adapters.py | ●●●●● patch | view | raw | blame | history | |
pyramid/tests/test_config/test_init.py | ●●●●● patch | view | raw | blame | history |
pyramid/config/__init__.py
@@ -333,7 +333,6 @@ self._fix_registry() self._set_settings(settings) self._register_response_adapters() if isinstance(debug_logger, string_types): debug_logger = logging.getLogger(debug_logger) @@ -343,6 +342,7 @@ registry.registerUtility(debug_logger, IDebugLogger) self.add_default_response_adapters() self.add_default_renderers() self.add_default_view_predicates() self.add_default_route_predicates() @@ -362,12 +362,12 @@ self.commit() # self.commit() should not be called after this point because the # following registrations should be treated as analogues of methods # called by the user after configurator construction. Rationale: # user-supplied implementations should be preferred rather than # add-on author implementations with the help of automatic conflict # resolution. # self.commit() should not be called within this method after this # point because the following registrations should be treated as # analogues of methods called by the user after configurator # construction. Rationale: user-supplied implementations should be # preferred rather than add-on author implementations with the help of # automatic conflict resolution. if authentication_policy and not authorization_policy: authorization_policy = ACLAuthorizationPolicy() # default pyramid/config/adapters.py
@@ -1,3 +1,5 @@ from webob import Response as WebobResponse from functools import update_wrapper from zope.interface import Interface @@ -193,10 +195,9 @@ intr['type'] = type_or_iface self.action(discriminator, register, introspectables=(intr,)) def _register_response_adapters(self): def add_default_response_adapters(self): # cope with WebOb response objects that aren't decorated with IResponse from webob import Response as WebobResponse self.registry.registerSelfAdapter((WebobResponse,), IResponse) self.add_response_adapter(None, WebobResponse) @action_method def add_traverser(self, adapter, iface=None): pyramid/tests/test_config/test_init.py
@@ -227,6 +227,14 @@ config = self._makeOne(introspection=False) self.assertEqual(config.introspection, False) def test_ctor_default_webob_response_adapter_registered(self): from webob import Response as WebobResponse response = WebobResponse() from pyramid.interfaces import IResponse config = self._makeOne(autocommit=True) result = config.registry.queryAdapter(response, IResponse) self.assertEqual(result, response) def test_with_package_module(self): from pyramid.tests.test_config import test_init import pyramid.tests