diff options
| author | Michael Merickel <michael@merickel.org> | 2015-02-07 02:38:54 -0600 |
|---|---|---|
| committer | Michael Merickel <michael@merickel.org> | 2015-02-07 02:38:54 -0600 |
| commit | da5f5f9ea02c2c9830c7ae016547d2bedd0e0171 (patch) | |
| tree | bc1934fa7d7b59b699d055dbcc57449d6e79242f | |
| parent | c10354859a055270a028778e3f7c3b7fc8f39f63 (diff) | |
| download | pyramid-da5f5f9ea02c2c9830c7ae016547d2bedd0e0171.tar.gz pyramid-da5f5f9ea02c2c9830c7ae016547d2bedd0e0171.tar.bz2 pyramid-da5f5f9ea02c2c9830c7ae016547d2bedd0e0171.zip | |
move the IResponseFactory into the public api
| -rw-r--r-- | docs/api/interfaces.rst | 3 | ||||
| -rw-r--r-- | docs/glossary.rst | 3 | ||||
| -rw-r--r-- | docs/narr/hooks.rst | 8 | ||||
| -rw-r--r-- | pyramid/config/factories.py | 5 | ||||
| -rw-r--r-- | pyramid/interfaces.py | 11 | ||||
| -rw-r--r-- | pyramid/util.py | 5 |
6 files changed, 16 insertions, 19 deletions
diff --git a/docs/api/interfaces.rst b/docs/api/interfaces.rst index a62976d8a..de2a664a4 100644 --- a/docs/api/interfaces.rst +++ b/docs/api/interfaces.rst @@ -56,6 +56,9 @@ Other Interfaces .. autointerface:: IRenderer :members: + .. autointerface:: IResponseFactory + :members: + .. autointerface:: IViewMapperFactory :members: diff --git a/docs/glossary.rst b/docs/glossary.rst index 911c22075..9c0ea8598 100644 --- a/docs/glossary.rst +++ b/docs/glossary.rst @@ -18,7 +18,8 @@ Glossary response factory An object which, provided a :term:`request` as a single positional - argument, returns a Pyramid-compatible response. + argument, returns a Pyramid-compatible response. See + :class:`pyramid.interfaces.IResponseFactory`. response An object returned by a :term:`view callable` that represents response diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst index 8e6cf8343..4fd7670b9 100644 --- a/docs/narr/hooks.rst +++ b/docs/narr/hooks.rst @@ -364,12 +364,12 @@ Whenever :app:`Pyramid` returns a response from a view it creates a object. The factory that :app:`Pyramid` uses to create a response object instance can be -changed by passing a ``response_factory`` argument to the constructor of the -:term:`configurator`. This argument can be either a callable or a -:term:`dotted Python name` representing a callable. +changed by passing a :class:`pyramid.interfaces.IResponseFactory` argument to +the constructor of the :term:`configurator`. This argument can be either a +callable or a :term:`dotted Python name` representing a callable. The factory takes a single positional argument, which is a :term:`Request` -object. The argument may be the value ``None``. +object. The argument may be ``None``. .. code-block:: python :linenos: diff --git a/pyramid/config/factories.py b/pyramid/config/factories.py index d7a48ba93..15cfb796f 100644 --- a/pyramid/config/factories.py +++ b/pyramid/config/factories.py @@ -102,9 +102,8 @@ class FactoriesConfiguratorMixin(object): """ The object passed as ``factory`` should be an object (or a :term:`dotted Python name` which refers to an object) which will be used by the :app:`Pyramid` as the default response - objects. This factory object must have the same - methods and attributes as the - :class:`pyramid.request.Response` class. + objects. The factory should conform to the + :class:`pyramid.interfaces.IResponseFactory` interface. .. note:: diff --git a/pyramid/interfaces.py b/pyramid/interfaces.py index b21c6b9cc..0f1b4efc3 100644 --- a/pyramid/interfaces.py +++ b/pyramid/interfaces.py @@ -582,12 +582,11 @@ class IStaticURLInfo(Interface): """ Generate a URL for the given path """ class IResponseFactory(Interface): - """ A utility which generates a response factory """ - def __call__(): - """ Return a response factory (e.g. a callable that returns an object - implementing IResponse, e.g. :class:`pyramid.response.Response`). It - should accept all the arguments that the Pyramid Response class - accepts.""" + """ A utility which generates a response """ + def __call__(request): + """ Return a response object implementing IResponse, + e.g. :class:`pyramid.response.Response`). It should handle the + case when ``request`` is ``None``.""" class IRequestFactory(Interface): """ A utility which generates a request """ diff --git a/pyramid/util.py b/pyramid/util.py index 4ca2937a1..18cef4602 100644 --- a/pyramid/util.py +++ b/pyramid/util.py @@ -15,10 +15,6 @@ from pyramid.exceptions import ( CyclicDependencyError, ) -from pyramid.interfaces import ( - IResponseFactory, - ) - from pyramid.compat import ( iteritems_, is_nonstr_iter, @@ -29,7 +25,6 @@ from pyramid.compat import ( ) from pyramid.interfaces import IActionInfo -from pyramid.response import Response from pyramid.path import DottedNameResolver as _DottedNameResolver class DottedNameResolver(_DottedNameResolver): |
