Permalink
Browse files

rename set_request_method to add_request_method. closes #683

  • Loading branch information...
1 parent cf3d1ef commit 023c88b67b907dd3682ef71216245609c9bbdbe1 @mcdonc mcdonc committed Sep 10, 2012
Showing with 24 additions and 24 deletions.
  1. +2 −2 CHANGES.txt
  2. +2 −2 TODO.txt
  3. +1 −1 docs/api/config.rst
  4. +1 −1 docs/narr/advconfig.rst
  5. +3 −3 pyramid/config/factories.py
  6. +15 −15 pyramid/tests/test_config/test_factories.py
View
@@ -87,7 +87,7 @@ Features
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 @@ Deprecations
- 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).
View
@@ -106,8 +106,8 @@ Future
- 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.
View
@@ -40,7 +40,7 @@
:methodcategory:`Extending the Request Object`
- .. automethod:: set_request_method
+ .. automethod:: add_request_method
.. automethod:: set_request_property
:methodcategory:`Using I18N`
@@ -294,9 +294,9 @@ These are the methods of the configurator which provide conflict detection:
: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`,
@@ -96,7 +96,7 @@ def register():
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 @@ def set_request_property(self, callable, name=None, reify=False):
.. 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)
@@ -129,32 +129,32 @@ class Event(object):
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)
event = Event()
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 @@ def test_set_multiple_request_methods_conflict(self):
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):

0 comments on commit 023c88b

Please sign in to comment.