We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
add_request_method only accepts property descriptor that subclasses property
https://github.com/Pylons/pyramid/blob/cc6a6ed60260b0391aa38f372b26311d58edf0d6/pyramid/util.py#L70

Looks like we check the type of a property descriptor by `isinstance(callable, property)`. This is not true for property descriptors subclasses from `object` which is pretty common. Maybe we should document this behavior [here](https://docs.pylonsproject.org/projects/pyramid/en/latest/api/config.html#pyramid.config.Configurator.add_request_method).


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pyramid/config/factories.py`
Content:
```
1 from zope.deprecation import deprecated
2 from zope.interface import implementer
3 
4 from pyramid.interfaces import (
5     IDefaultRootFactory,
6     IExecutionPolicy,
7     IRequestFactory,
8     IResponseFactory,
9     IRequestExtensions,
10     IRootFactory,
11     ISessionFactory,
12     )
13 
14 from pyramid.router import default_execution_policy
15 from pyramid.traversal import DefaultRootFactory
16 
17 from pyramid.util import (
18     action_method,
19     get_callable_name,
20     InstancePropertyHelper,
21     )
22 
23 
24 class FactoriesConfiguratorMixin(object):
25     @action_method
26     def set_root_factory(self, factory):
27         """ Add a :term:`root factory` to the current configuration
28         state.  If the ``factory`` argument is ``None`` a default root
29         factory will be registered.
30 
31         .. note::
32 
33            Using the ``root_factory`` argument to the
34            :class:`pyramid.config.Configurator` constructor can be used to
35            achieve the same purpose.
36         """
37         factory = self.maybe_dotted(factory)
38         if factory is None:
39             factory = DefaultRootFactory
40 
41         def register():
42             self.registry.registerUtility(factory, IRootFactory)
43             self.registry.registerUtility(factory, IDefaultRootFactory)  # b/c
44 
45         intr = self.introspectable('root factories',
46                                    None,
47                                    self.object_description(factory),
48                                    'root factory')
49         intr['factory'] = factory
50         self.action(IRootFactory, register, introspectables=(intr,))
51 
52     _set_root_factory = set_root_factory  # bw compat
53 
54     @action_method
55     def set_session_factory(self, factory):
56         """
57         Configure the application with a :term:`session factory`.  If this
58         method is called, the ``factory`` argument must be a session
59         factory callable or a :term:`dotted Python name` to that factory.
60 
61         .. note::
62 
63            Using the ``session_factory`` argument to the
64            :class:`pyramid.config.Configurator` constructor can be used to
65            achieve the same purpose.
66         """
67         factory = self.maybe_dotted(factory)
68 
69         def register():
70             self.registry.registerUtility(factory, ISessionFactory)
71         intr = self.introspectable('session factory', None,
72                                    self.object_description(factory),
73                                    'session factory')
74         intr['factory'] = factory
75         self.action(ISessionFactory, register, introspectables=(intr,))
76 
77     @action_method
78     def set_request_factory(self, factory):
79         """ The object passed as ``factory`` should be an object (or a
80         :term:`dotted Python name` which refers to an object) which
81         will be used by the :app:`Pyramid` router to create all
82         request objects.  This factory object must have the same
83         methods and attributes as the
84         :class:`pyramid.request.Request` class (particularly
85         ``__call__``, and ``blank``).
86 
87         See :meth:`pyramid.config.Configurator.add_request_method`
88         for a less intrusive way to extend the request objects with
89         custom methods and properties.
90 
91         .. note::
92 
93            Using the ``request_factory`` argument to the
94            :class:`pyramid.config.Configurator` constructor
95            can be used to achieve the same purpose.
96         """
97         factory = self.maybe_dotted(factory)
98 
99         def register():
100             self.registry.registerUtility(factory, IRequestFactory)
101         intr = self.introspectable('request factory', None,
102                                    self.object_description(factory),
103                                    'request factory')
104         intr['factory'] = factory
105         self.action(IRequestFactory, register, introspectables=(intr,))
106 
107     @action_method
108     def set_response_factory(self, factory):
109         """ The object passed as ``factory`` should be an object (or a
110         :term:`dotted Python name` which refers to an object) which
111         will be used by the :app:`Pyramid` as the default response
112         objects. The factory should conform to the
113         :class:`pyramid.interfaces.IResponseFactory` interface.
114 
115         .. note::
116 
117            Using the ``response_factory`` argument to the
118            :class:`pyramid.config.Configurator` constructor
119            can be used to achieve the same purpose.
120         """
121         factory = self.maybe_dotted(factory)
122 
123         def register():
124             self.registry.registerUtility(factory, IResponseFactory)
125 
126         intr = self.introspectable('response factory', None,
127                                    self.object_description(factory),
128                                    'response factory')
129         intr['factory'] = factory
130         self.action(IResponseFactory, register, introspectables=(intr,))
131 
132     @action_method
133     def add_request_method(self,
134                            callable=None,
135                            name=None,
136                            property=False,
137                            reify=False):
138         """ Add a property or method to the request object.
139 
140         When adding a method to the request, ``callable`` may be any
141         function that receives the request object as the first
142         parameter. If ``name`` is ``None`` then it will be computed
143         from the name of the ``callable``.
144 
145         When adding a property to the request, ``callable`` can either
146         be a callable that accepts the request as its single positional
147         parameter, or it can be a property descriptor. If ``name`` is
148         ``None``, the name of the property will be computed from the
149         name of the ``callable``.
150 
151         If the ``callable`` is a property descriptor a ``ValueError``
152         will be raised if ``name`` is ``None`` or ``reify`` is ``True``.
153 
154         See :meth:`pyramid.request.Request.set_property` for more
155         details on ``property`` vs ``reify``. When ``reify`` is
156         ``True``, the value of ``property`` is assumed to also be
157         ``True``.
158 
159         In all cases, ``callable`` may also be a
160         :term:`dotted Python name` which refers to either a callable or
161         a property descriptor.
162 
163         If ``callable`` is ``None`` then the method is only used to
164         assist in conflict detection between different addons requesting
165         the same attribute on the request object.
166 
167         This is the recommended method for extending the request object
168         and should be used in favor of providing a custom request
169         factory via
170         :meth:`pyramid.config.Configurator.set_request_factory`.
171 
172         .. versionadded:: 1.4
173         """
174         if callable is not None:
175             callable = self.maybe_dotted(callable)
176 
177         property = property or reify
178         if property:
179             name, callable = InstancePropertyHelper.make_property(
180                 callable, name=name, reify=reify)
181         elif name is None:
182             name = callable.__name__
183         else:
184             name = get_callable_name(name)
185 
186         def register():
187             exts = self.registry.queryUtility(IRequestExtensions)
188 
189             if exts is None:
190                 exts = _RequestExtensions()
191                 self.registry.registerUtility(exts, IRequestExtensions)
192 
193             plist = exts.descriptors if property else exts.methods
194             plist[name] = callable
195 
196         if callable is None:
197             self.action(('request extensions', name), None)
198         elif property:
199             intr = self.introspectable('request extensions', name,
200                                        self.object_description(callable),
201                                        'request property')
202             intr['callable'] = callable
203             intr['property'] = True
204             intr['reify'] = reify
205             self.action(('request extensions', name), register,
206                         introspectables=(intr,))
207         else:
208             intr = self.introspectable('request extensions', name,
209                                        self.object_description(callable),
210                                        'request method')
211             intr['callable'] = callable
212             intr['property'] = False
213             intr['reify'] = False
214             self.action(('request extensions', name), register,
215                         introspectables=(intr,))
216 
217     @action_method
218     def set_request_property(self, callable, name=None, reify=False):
219         """ Add a property to the request object.
220 
221         .. deprecated:: 1.5
222             :meth:`pyramid.config.Configurator.add_request_method` should be
223             used instead.  (This method was docs-deprecated in 1.4 and
224             issues a real deprecation warning in 1.5).
225 
226         .. versionadded:: 1.3
227         """
228         self.add_request_method(
229             callable, name=name, property=not reify, reify=reify)
230 
231     deprecated(
232         set_request_property,
233         'set_request_propery() is deprecated as of Pyramid 1.5; use '
234         'add_request_method() with the property=True argument instead')
235 
236     @action_method
237     def set_execution_policy(self, policy):
238         """
239         Override the :app:`Pyramid` :term:`execution policy` in the
240         current configuration.  The ``policy`` argument must be an instance
241         of an :class:`pyramid.interfaces.IExecutionPolicy` or a
242         :term:`dotted Python name` that points at an instance of an
243         execution policy.
244 
245         """
246         policy = self.maybe_dotted(policy)
247         if policy is None:
248             policy = default_execution_policy
249 
250         def register():
251             self.registry.registerUtility(policy, IExecutionPolicy)
252 
253         intr = self.introspectable('execution policy', None,
254                                    self.object_description(policy),
255                                    'execution policy')
256         intr['policy'] = policy
257         self.action(IExecutionPolicy, register, introspectables=(intr,))
258 
259 
260 @implementer(IRequestExtensions)
261 class _RequestExtensions(object):
262     def __init__(self):
263         self.descriptors = {}
264         self.methods = {}
265
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pyramid/config/factories.py b/pyramid/config/factories.py
--- a/pyramid/config/factories.py
+++ b/pyramid/config/factories.py
@@ -144,9 +144,10 @@
 
         When adding a property to the request, ``callable`` can either
         be a callable that accepts the request as its single positional
-        parameter, or it can be a property descriptor. If ``name`` is
-        ``None``, the name of the property will be computed from the
-        name of the ``callable``.
+        parameter, or it can be a property descriptor. If ``callable`` is
+        a property descriptor, it has to be an instance of a class which is
+        a subclass of ``property``. If ``name`` is ``None``, the name of
+        the property will be computed from the name of the ``callable``.
 
         If the ``callable`` is a property descriptor a ``ValueError``
         will be raised if ``name`` is ``None`` or ``reify`` is ``True``.

{"golden_diff": "diff --git a/pyramid/config/factories.py b/pyramid/config/factories.py\n--- a/pyramid/config/factories.py\n+++ b/pyramid/config/factories.py\n@@ -144,9 +144,10 @@\n \n         When adding a property to the request, ``callable`` can either\n         be a callable that accepts the request as its single positional\n-        parameter, or it can be a property descriptor. If ``name`` is\n-        ``None``, the name of the property will be computed from the\n-        name of the ``callable``.\n+        parameter, or it can be a property descriptor. If ``callable`` is\n+        a property descriptor, it has to be an instance of a class which is\n+        a subclass of ``property``. If ``name`` is ``None``, the name of\n+        the property will be computed from the name of the ``callable``.\n \n         If the ``callable`` is a property descriptor a ``ValueError``\n         will be raised if ``name`` is ``None`` or ``reify`` is ``True``.\n", "issue": "add_request_method only accepts property descriptor that subclasses property\nhttps://github.com/Pylons/pyramid/blob/cc6a6ed60260b0391aa38f372b26311d58edf0d6/pyramid/util.py#L70\r\n\r\nLooks like we check the type of a property descriptor by `isinstance(callable, property)`. This is not true for property descriptors subclasses from `object` which is pretty common. Maybe we should document this behavior [here](https://docs.pylonsproject.org/projects/pyramid/en/latest/api/config.html#pyramid.config.Configurator.add_request_method).\r\n\n", "before_files": [{"content": "from zope.deprecation import deprecated\nfrom zope.interface import implementer\n\nfrom pyramid.interfaces import (\n    IDefaultRootFactory,\n    IExecutionPolicy,\n    IRequestFactory,\n    IResponseFactory,\n    IRequestExtensions,\n    IRootFactory,\n    ISessionFactory,\n    )\n\nfrom pyramid.router import default_execution_policy\nfrom pyramid.traversal import DefaultRootFactory\n\nfrom pyramid.util import (\n    action_method,\n    get_callable_name,\n    InstancePropertyHelper,\n    )\n\n\nclass FactoriesConfiguratorMixin(object):\n    @action_method\n    def set_root_factory(self, factory):\n        \"\"\" Add a :term:`root factory` to the current configuration\n        state.  If the ``factory`` argument is ``None`` a default root\n        factory will be registered.\n\n        .. note::\n\n           Using the ``root_factory`` argument to the\n           :class:`pyramid.config.Configurator` constructor can be used to\n           achieve the same purpose.\n        \"\"\"\n        factory = self.maybe_dotted(factory)\n        if factory is None:\n            factory = DefaultRootFactory\n\n        def register():\n            self.registry.registerUtility(factory, IRootFactory)\n            self.registry.registerUtility(factory, IDefaultRootFactory)  # b/c\n\n        intr = self.introspectable('root factories',\n                                   None,\n                                   self.object_description(factory),\n                                   'root factory')\n        intr['factory'] = factory\n        self.action(IRootFactory, register, introspectables=(intr,))\n\n    _set_root_factory = set_root_factory  # bw compat\n\n    @action_method\n    def set_session_factory(self, factory):\n        \"\"\"\n        Configure the application with a :term:`session factory`.  If this\n        method is called, the ``factory`` argument must be a session\n        factory callable or a :term:`dotted Python name` to that factory.\n\n        .. note::\n\n           Using the ``session_factory`` argument to the\n           :class:`pyramid.config.Configurator` constructor can be used to\n           achieve the same purpose.\n        \"\"\"\n        factory = self.maybe_dotted(factory)\n\n        def register():\n            self.registry.registerUtility(factory, ISessionFactory)\n        intr = self.introspectable('session factory', None,\n                                   self.object_description(factory),\n                                   'session factory')\n        intr['factory'] = factory\n        self.action(ISessionFactory, register, introspectables=(intr,))\n\n    @action_method\n    def set_request_factory(self, factory):\n        \"\"\" The object passed as ``factory`` should be an object (or a\n        :term:`dotted Python name` which refers to an object) which\n        will be used by the :app:`Pyramid` router to create all\n        request objects.  This factory object must have the same\n        methods and attributes as the\n        :class:`pyramid.request.Request` class (particularly\n        ``__call__``, and ``blank``).\n\n        See :meth:`pyramid.config.Configurator.add_request_method`\n        for a less intrusive way to extend the request objects with\n        custom methods and properties.\n\n        .. note::\n\n           Using the ``request_factory`` argument to the\n           :class:`pyramid.config.Configurator` constructor\n           can be used to achieve the same purpose.\n        \"\"\"\n        factory = self.maybe_dotted(factory)\n\n        def register():\n            self.registry.registerUtility(factory, IRequestFactory)\n        intr = self.introspectable('request factory', None,\n                                   self.object_description(factory),\n                                   'request factory')\n        intr['factory'] = factory\n        self.action(IRequestFactory, register, introspectables=(intr,))\n\n    @action_method\n    def set_response_factory(self, factory):\n        \"\"\" The object passed as ``factory`` should be an object (or a\n        :term:`dotted Python name` which refers to an object) which\n        will be used by the :app:`Pyramid` as the default response\n        objects. The factory should conform to the\n        :class:`pyramid.interfaces.IResponseFactory` interface.\n\n        .. note::\n\n           Using the ``response_factory`` argument to the\n           :class:`pyramid.config.Configurator` constructor\n           can be used to achieve the same purpose.\n        \"\"\"\n        factory = self.maybe_dotted(factory)\n\n        def register():\n            self.registry.registerUtility(factory, IResponseFactory)\n\n        intr = self.introspectable('response factory', None,\n                                   self.object_description(factory),\n                                   'response factory')\n        intr['factory'] = factory\n        self.action(IResponseFactory, register, introspectables=(intr,))\n\n    @action_method\n    def add_request_method(self,\n                           callable=None,\n                           name=None,\n                           property=False,\n                           reify=False):\n        \"\"\" Add a property or method to the request object.\n\n        When adding a method to the request, ``callable`` may be any\n        function that receives the request object as the first\n        parameter. If ``name`` is ``None`` then it will be computed\n        from the name of the ``callable``.\n\n        When adding a property to the request, ``callable`` can either\n        be a callable that accepts the request as its single positional\n        parameter, or it can be a property descriptor. If ``name`` is\n        ``None``, the name of the property will be computed from the\n        name of the ``callable``.\n\n        If the ``callable`` is a property descriptor a ``ValueError``\n        will be raised if ``name`` is ``None`` or ``reify`` is ``True``.\n\n        See :meth:`pyramid.request.Request.set_property` for more\n        details on ``property`` vs ``reify``. When ``reify`` is\n        ``True``, the value of ``property`` is assumed to also be\n        ``True``.\n\n        In all cases, ``callable`` may also be a\n        :term:`dotted Python name` which refers to either a callable or\n        a property descriptor.\n\n        If ``callable`` is ``None`` then the method is only used to\n        assist in conflict detection between different addons requesting\n        the same attribute on the request object.\n\n        This is the recommended method for extending the request object\n        and should be used in favor of providing a custom request\n        factory via\n        :meth:`pyramid.config.Configurator.set_request_factory`.\n\n        .. versionadded:: 1.4\n        \"\"\"\n        if callable is not None:\n            callable = self.maybe_dotted(callable)\n\n        property = property or reify\n        if property:\n            name, callable = InstancePropertyHelper.make_property(\n                callable, name=name, reify=reify)\n        elif name is None:\n            name = callable.__name__\n        else:\n            name = get_callable_name(name)\n\n        def register():\n            exts = self.registry.queryUtility(IRequestExtensions)\n\n            if exts is None:\n                exts = _RequestExtensions()\n                self.registry.registerUtility(exts, IRequestExtensions)\n\n            plist = exts.descriptors if property else exts.methods\n            plist[name] = callable\n\n        if callable is None:\n            self.action(('request extensions', name), None)\n        elif property:\n            intr = self.introspectable('request extensions', name,\n                                       self.object_description(callable),\n                                       'request property')\n            intr['callable'] = callable\n            intr['property'] = True\n            intr['reify'] = reify\n            self.action(('request extensions', name), register,\n                        introspectables=(intr,))\n        else:\n            intr = self.introspectable('request extensions', name,\n                                       self.object_description(callable),\n                                       'request method')\n            intr['callable'] = callable\n            intr['property'] = False\n            intr['reify'] = False\n            self.action(('request extensions', name), register,\n                        introspectables=(intr,))\n\n    @action_method\n    def set_request_property(self, callable, name=None, reify=False):\n        \"\"\" Add a property to the request object.\n\n        .. deprecated:: 1.5\n            :meth:`pyramid.config.Configurator.add_request_method` should be\n            used instead.  (This method was docs-deprecated in 1.4 and\n            issues a real deprecation warning in 1.5).\n\n        .. versionadded:: 1.3\n        \"\"\"\n        self.add_request_method(\n            callable, name=name, property=not reify, reify=reify)\n\n    deprecated(\n        set_request_property,\n        'set_request_propery() is deprecated as of Pyramid 1.5; use '\n        'add_request_method() with the property=True argument instead')\n\n    @action_method\n    def set_execution_policy(self, policy):\n        \"\"\"\n        Override the :app:`Pyramid` :term:`execution policy` in the\n        current configuration.  The ``policy`` argument must be an instance\n        of an :class:`pyramid.interfaces.IExecutionPolicy` or a\n        :term:`dotted Python name` that points at an instance of an\n        execution policy.\n\n        \"\"\"\n        policy = self.maybe_dotted(policy)\n        if policy is None:\n            policy = default_execution_policy\n\n        def register():\n            self.registry.registerUtility(policy, IExecutionPolicy)\n\n        intr = self.introspectable('execution policy', None,\n                                   self.object_description(policy),\n                                   'execution policy')\n        intr['policy'] = policy\n        self.action(IExecutionPolicy, register, introspectables=(intr,))\n\n\n@implementer(IRequestExtensions)\nclass _RequestExtensions(object):\n    def __init__(self):\n        self.descriptors = {}\n        self.methods = {}\n", "path": "pyramid/config/factories.py"}], "after_files": [{"content": "from zope.deprecation import deprecated\nfrom zope.interface import implementer\n\nfrom pyramid.interfaces import (\n    IDefaultRootFactory,\n    IExecutionPolicy,\n    IRequestFactory,\n    IResponseFactory,\n    IRequestExtensions,\n    IRootFactory,\n    ISessionFactory,\n    )\n\nfrom pyramid.router import default_execution_policy\nfrom pyramid.traversal import DefaultRootFactory\n\nfrom pyramid.util import (\n    action_method,\n    get_callable_name,\n    InstancePropertyHelper,\n    )\n\n\nclass FactoriesConfiguratorMixin(object):\n    @action_method\n    def set_root_factory(self, factory):\n        \"\"\" Add a :term:`root factory` to the current configuration\n        state.  If the ``factory`` argument is ``None`` a default root\n        factory will be registered.\n\n        .. note::\n\n           Using the ``root_factory`` argument to the\n           :class:`pyramid.config.Configurator` constructor can be used to\n           achieve the same purpose.\n        \"\"\"\n        factory = self.maybe_dotted(factory)\n        if factory is None:\n            factory = DefaultRootFactory\n\n        def register():\n            self.registry.registerUtility(factory, IRootFactory)\n            self.registry.registerUtility(factory, IDefaultRootFactory)  # b/c\n\n        intr = self.introspectable('root factories',\n                                   None,\n                                   self.object_description(factory),\n                                   'root factory')\n        intr['factory'] = factory\n        self.action(IRootFactory, register, introspectables=(intr,))\n\n    _set_root_factory = set_root_factory  # bw compat\n\n    @action_method\n    def set_session_factory(self, factory):\n        \"\"\"\n        Configure the application with a :term:`session factory`.  If this\n        method is called, the ``factory`` argument must be a session\n        factory callable or a :term:`dotted Python name` to that factory.\n\n        .. note::\n\n           Using the ``session_factory`` argument to the\n           :class:`pyramid.config.Configurator` constructor can be used to\n           achieve the same purpose.\n        \"\"\"\n        factory = self.maybe_dotted(factory)\n\n        def register():\n            self.registry.registerUtility(factory, ISessionFactory)\n        intr = self.introspectable('session factory', None,\n                                   self.object_description(factory),\n                                   'session factory')\n        intr['factory'] = factory\n        self.action(ISessionFactory, register, introspectables=(intr,))\n\n    @action_method\n    def set_request_factory(self, factory):\n        \"\"\" The object passed as ``factory`` should be an object (or a\n        :term:`dotted Python name` which refers to an object) which\n        will be used by the :app:`Pyramid` router to create all\n        request objects.  This factory object must have the same\n        methods and attributes as the\n        :class:`pyramid.request.Request` class (particularly\n        ``__call__``, and ``blank``).\n\n        See :meth:`pyramid.config.Configurator.add_request_method`\n        for a less intrusive way to extend the request objects with\n        custom methods and properties.\n\n        .. note::\n\n           Using the ``request_factory`` argument to the\n           :class:`pyramid.config.Configurator` constructor\n           can be used to achieve the same purpose.\n        \"\"\"\n        factory = self.maybe_dotted(factory)\n\n        def register():\n            self.registry.registerUtility(factory, IRequestFactory)\n        intr = self.introspectable('request factory', None,\n                                   self.object_description(factory),\n                                   'request factory')\n        intr['factory'] = factory\n        self.action(IRequestFactory, register, introspectables=(intr,))\n\n    @action_method\n    def set_response_factory(self, factory):\n        \"\"\" The object passed as ``factory`` should be an object (or a\n        :term:`dotted Python name` which refers to an object) which\n        will be used by the :app:`Pyramid` as the default response\n        objects. The factory should conform to the\n        :class:`pyramid.interfaces.IResponseFactory` interface.\n\n        .. note::\n\n           Using the ``response_factory`` argument to the\n           :class:`pyramid.config.Configurator` constructor\n           can be used to achieve the same purpose.\n        \"\"\"\n        factory = self.maybe_dotted(factory)\n\n        def register():\n            self.registry.registerUtility(factory, IResponseFactory)\n\n        intr = self.introspectable('response factory', None,\n                                   self.object_description(factory),\n                                   'response factory')\n        intr['factory'] = factory\n        self.action(IResponseFactory, register, introspectables=(intr,))\n\n    @action_method\n    def add_request_method(self,\n                           callable=None,\n                           name=None,\n                           property=False,\n                           reify=False):\n        \"\"\" Add a property or method to the request object.\n\n        When adding a method to the request, ``callable`` may be any\n        function that receives the request object as the first\n        parameter. If ``name`` is ``None`` then it will be computed\n        from the name of the ``callable``.\n\n        When adding a property to the request, ``callable`` can either\n        be a callable that accepts the request as its single positional\n        parameter, or it can be a property descriptor. If ``callable`` is\n        a property descriptor, it has to be an instance of a class which is\n        a subclass of ``property``. If ``name`` is ``None``, the name of\n        the property will be computed from the name of the ``callable``.\n\n        If the ``callable`` is a property descriptor a ``ValueError``\n        will be raised if ``name`` is ``None`` or ``reify`` is ``True``.\n\n        See :meth:`pyramid.request.Request.set_property` for more\n        details on ``property`` vs ``reify``. When ``reify`` is\n        ``True``, the value of ``property`` is assumed to also be\n        ``True``.\n\n        In all cases, ``callable`` may also be a\n        :term:`dotted Python name` which refers to either a callable or\n        a property descriptor.\n\n        If ``callable`` is ``None`` then the method is only used to\n        assist in conflict detection between different addons requesting\n        the same attribute on the request object.\n\n        This is the recommended method for extending the request object\n        and should be used in favor of providing a custom request\n        factory via\n        :meth:`pyramid.config.Configurator.set_request_factory`.\n\n        .. versionadded:: 1.4\n        \"\"\"\n        if callable is not None:\n            callable = self.maybe_dotted(callable)\n\n        property = property or reify\n        if property:\n            name, callable = InstancePropertyHelper.make_property(\n                callable, name=name, reify=reify)\n        elif name is None:\n            name = callable.__name__\n        else:\n            name = get_callable_name(name)\n\n        def register():\n            exts = self.registry.queryUtility(IRequestExtensions)\n\n            if exts is None:\n                exts = _RequestExtensions()\n                self.registry.registerUtility(exts, IRequestExtensions)\n\n            plist = exts.descriptors if property else exts.methods\n            plist[name] = callable\n\n        if callable is None:\n            self.action(('request extensions', name), None)\n        elif property:\n            intr = self.introspectable('request extensions', name,\n                                       self.object_description(callable),\n                                       'request property')\n            intr['callable'] = callable\n            intr['property'] = True\n            intr['reify'] = reify\n            self.action(('request extensions', name), register,\n                        introspectables=(intr,))\n        else:\n            intr = self.introspectable('request extensions', name,\n                                       self.object_description(callable),\n                                       'request method')\n            intr['callable'] = callable\n            intr['property'] = False\n            intr['reify'] = False\n            self.action(('request extensions', name), register,\n                        introspectables=(intr,))\n\n    @action_method\n    def set_request_property(self, callable, name=None, reify=False):\n        \"\"\" Add a property to the request object.\n\n        .. deprecated:: 1.5\n            :meth:`pyramid.config.Configurator.add_request_method` should be\n            used instead.  (This method was docs-deprecated in 1.4 and\n            issues a real deprecation warning in 1.5).\n\n        .. versionadded:: 1.3\n        \"\"\"\n        self.add_request_method(\n            callable, name=name, property=not reify, reify=reify)\n\n    deprecated(\n        set_request_property,\n        'set_request_propery() is deprecated as of Pyramid 1.5; use '\n        'add_request_method() with the property=True argument instead')\n\n    @action_method\n    def set_execution_policy(self, policy):\n        \"\"\"\n        Override the :app:`Pyramid` :term:`execution policy` in the\n        current configuration.  The ``policy`` argument must be an instance\n        of an :class:`pyramid.interfaces.IExecutionPolicy` or a\n        :term:`dotted Python name` that points at an instance of an\n        execution policy.\n\n        \"\"\"\n        policy = self.maybe_dotted(policy)\n        if policy is None:\n            policy = default_execution_policy\n\n        def register():\n            self.registry.registerUtility(policy, IExecutionPolicy)\n\n        intr = self.introspectable('execution policy', None,\n                                   self.object_description(policy),\n                                   'execution policy')\n        intr['policy'] = policy\n        self.action(IExecutionPolicy, register, introspectables=(intr,))\n\n\n@implementer(IRequestExtensions)\nclass _RequestExtensions(object):\n    def __init__(self):\n        self.descriptors = {}\n        self.methods = {}\n", "path": "pyramid/config/factories.py"}]}