CHANGES.txt | ●●●●● patch | view | raw | blame | history | |
TODO.txt | ●●●●● patch | view | raw | blame | history | |
docs/api/config.rst | ●●●●● patch | view | raw | blame | history | |
docs/narr/advconfig.rst | ●●●●● patch | view | raw | blame | history | |
pyramid/config/factories.py | ●●●●● patch | view | raw | blame | history | |
pyramid/tests/test_config/test_factories.py | ●●●●● patch | view | raw | blame | history |
CHANGES.txt
@@ -87,7 +87,7 @@ HEAD is a variant of GET that omits the body, and WebOb has special support to return an empty body when a HEAD is used. - ``config.set_request_method`` has been introduced to support extending - ``config.add_request_method`` has been introduced to support extending request objects with arbitrary callables. This method expands on the previous ``config.set_request_property`` by supporting methods as well as properties. This method now causes less code to be executed at @@ -149,7 +149,7 @@ - The ``pyramid.config.Configurator.set_request_property`` has been documentation-deprecated. The method remains usable but the more featureful ``pyramid.config.Configurator.set_request_method`` should be featureful ``pyramid.config.Configurator.add_request_method`` should be used in its place (it has all of the same capabilities but can also extend the request object with methods). TODO.txt
@@ -106,8 +106,8 @@ - 1.5: Remove ``pyramid.requests.DeprecatedRequestMethodsMixin``. - 1.6: Maybe? deprecate set_request_property in favor of pointing people at set_request_method. - 1.5: Maybe? deprecate set_request_property in favor of pointing people at add_request_method, schedule removal for 1.8? - 1.6: Remove IContextURL and TraversalContextURL. docs/api/config.rst
@@ -40,7 +40,7 @@ :methodcategory:`Extending the Request Object` .. automethod:: set_request_method .. automethod:: add_request_method .. automethod:: set_request_property :methodcategory:`Using I18N` docs/narr/advconfig.rst
@@ -294,9 +294,9 @@ :meth:`~pyramid.config.Configurator.add_view`, :meth:`~pyramid.config.Configurator.add_route`, :meth:`~pyramid.config.Configurator.add_renderer`, :meth:`~pyramid.config.Configurator.add_request_method`, :meth:`~pyramid.config.Configurator.set_request_factory`, :meth:`~pyramid.config.Configurator.set_session_factory`, :meth:`~pyramid.config.Configurator.set_request_method`, :meth:`~pyramid.config.Configurator.set_request_property`, :meth:`~pyramid.config.Configurator.set_root_factory`, :meth:`~pyramid.config.Configurator.set_view_mapper`, pyramid/config/factories.py
@@ -96,7 +96,7 @@ self.action(IRequestFactory, register, introspectables=(intr,)) @action_method def set_request_method(self, def add_request_method(self, callable=None, name=None, property=False, @@ -187,12 +187,12 @@ .. warning:: This method has been deprecated as of Pyramid 1.4. :meth:`pyramid.config.Configurator.set_request_method` should be :meth:`pyramid.config.Configurator.add_request_method` should be used instead. .. versionadded:: 1.3 """ self.set_request_method( self.add_request_method( callable, name=name, property=not reify, reify=reify) @implementer(IRequestExtensions) pyramid/tests/test_config/test_factories.py
@@ -129,12 +129,12 @@ self.assertEqual('bar', exts[0]) self.assertEqual('foo', exts[1]) def test_set_request_method_subscriber(self): def test_add_request_method_subscriber(self): from zope.interface import implementer from pyramid.interfaces import INewRequest config = self._makeOne(autocommit=True) def foo(r): return 'bar' config.set_request_method(foo, name='foo') config.add_request_method(foo, name='foo') @implementer(INewRequest) class Event(object): request = DummyRequest(config.registry) @@ -142,19 +142,19 @@ config.registry.notify(event) self.assertEqual('bar', event.request.foo()) def test_set_request_method_with_callable(self): def test_add_request_method_with_callable(self): from pyramid.interfaces import IRequestExtensions config = self._makeOne(autocommit=True) callable = lambda x: None config.set_request_method(callable, name='foo') config.add_request_method(callable, name='foo') exts = config.registry.getUtility(IRequestExtensions) self.assertTrue('foo' in exts.methods) def test_set_request_method_with_unnamed_callable(self): def test_add_request_method_with_unnamed_callable(self): from pyramid.interfaces import IRequestExtensions config = self._makeOne(autocommit=True) def foo(self): pass config.set_request_method(foo) config.add_request_method(foo) exts = config.registry.getUtility(IRequestExtensions) self.assertTrue('foo' in exts.methods) @@ -163,28 +163,28 @@ config = self._makeOne() def foo(self): pass def bar(self): pass config.set_request_method(foo, name='bar') config.set_request_method(bar, name='bar') config.add_request_method(foo, name='bar') config.add_request_method(bar, name='bar') self.assertRaises(ConfigurationConflictError, config.commit) def test_set_request_method_with_None_callable(self): def test_add_request_method_with_None_callable(self): from pyramid.interfaces import IRequestExtensions config = self._makeOne(autocommit=True) config.set_request_method(name='foo') config.add_request_method(name='foo') exts = config.registry.queryUtility(IRequestExtensions) self.assertTrue(exts is None) def test_set_request_method_with_None_callable_conflict(self): def test_add_request_method_with_None_callable_conflict(self): from pyramid.exceptions import ConfigurationConflictError config = self._makeOne() def bar(self): pass config.set_request_method(name='foo') config.set_request_method(bar, name='foo') config.add_request_method(name='foo') config.add_request_method(bar, name='foo') self.assertRaises(ConfigurationConflictError, config.commit) def test_set_request_method_with_None_callable_and_no_name(self): def test_add_request_method_with_None_callable_and_no_name(self): config = self._makeOne(autocommit=True) self.assertRaises(AttributeError, config.set_request_method) self.assertRaises(AttributeError, config.add_request_method) class DummyRequest(object):