From 1ffb8e3cc21603b29ccd78152f82cca7f61a09b1 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 16 May 2011 02:11:56 -0400 Subject: - Added API docs for ``pyramid.httpexceptions.abort`` and ``pyramid.httpexceptions.redirect``. - Added "HTTP Exceptions" section to Views narrative chapter including a description of ``pyramid.httpexceptions.abort``; adjusted redirect section to note ``pyramid.httpexceptions.redirect``. - A default exception view for the context ``webob.exc.HTTPException`` (aka ``pyramid.httpexceptions.HTTPException``) is now registered by default. This means that an instance of any exception class imported from ``pyramid.httpexceptions`` (such as ``HTTPFound``) can now be raised from within view code; when raised, this exception view will render the exception to a response. - New functions named ``pyramid.httpexceptions.abort`` and ``pyramid.httpexceptions.redirect`` perform the equivalent of their Pylons brethren when an HTTP exception handler is registered. These functions take advantage of the newly registered exception view for ``webob.exc.HTTPException``. - The Configurator now accepts an additional keyword argument named ``httpexception_view``. By default, this argument is populated with a default exception view function that will be used when an HTTP exception is raised. When ``None`` is passed for this value, an exception view for HTTP exceptions will not be registered. Passing ``None`` returns the behavior of raising an HTTP exception to that of Pyramid 1.0 (the exception will propagate to middleware and to the WSGI server). --- docs/api/httpexceptions.rst | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'docs/api') diff --git a/docs/api/httpexceptions.rst b/docs/api/httpexceptions.rst index 57ca8092c..73da4126b 100644 --- a/docs/api/httpexceptions.rst +++ b/docs/api/httpexceptions.rst @@ -5,6 +5,10 @@ .. automodule:: pyramid.httpexceptions + .. autofunction:: abort + + .. autofunction:: redirect + .. attribute:: status_map A mapping of integer status code to exception class (eg. the -- cgit v1.2.3 From df15ed98612e7962e3122da52d8d5f5b9d8882b2 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 4 Jun 2011 18:43:25 -0400 Subject: - It is now possible to control how the Pyramid router calls the WSGI ``start_response`` callable and obtains the WSGI ``app_iter`` based on adapting the response object to the new ``pyramid.interfaces.IResponder`` interface. The default ``IResponder`` uses Pyramid 1.0's logic to do this. To override the responder:: from pyramid.interfaces import IResponder from pyramid.response import Response from myapp import MyResponder config.registry.registerAdapter(MyResponder, (Response,), IResponder, name='') This makes it possible to reuse response object implementations which have, for example, their own ``__call__`` expected to be used as a WSGI application (like ``pyramid.response.Response``), e.g.: class MyResponder(object): def __init__(self, response): """ Obtain a reference to the response """ self.response = response def __call__(self, request, start_response): """ Call start_response and return an app_iter """ app_iter = self.response(request.environ, start_response) return app_iter --- docs/api/interfaces.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/api') diff --git a/docs/api/interfaces.rst b/docs/api/interfaces.rst index ac282fbcc..3a60fa4dc 100644 --- a/docs/api/interfaces.rst +++ b/docs/api/interfaces.rst @@ -57,4 +57,6 @@ Other Interfaces .. autointerface:: IMultiDict :members: + .. autointerface:: IResponder + :members: -- cgit v1.2.3 From 99edc51a3b05309c7f5d98ff96289ec51b1d7660 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 11 Jun 2011 05:35:27 -0400 Subject: - Pyramid now expects Response objects to have a __call__ method which implements the WSGI application interface instead of the three webob attrs status, headerlist and app_iter. Backwards compatibility exists for code which returns response objects that do not have a __call__. - pyramid.response.Response is no longer an exception (and therefore cannot be raised in order to generate a response). - Changed my mind about moving stuff from pyramid.httpexceptions to pyramid.response. The stuff I moved over has been moved back to pyramid.httpexceptions. --- docs/api/httpexceptions.rst | 6 ++---- docs/api/response.rst | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'docs/api') diff --git a/docs/api/httpexceptions.rst b/docs/api/httpexceptions.rst index 73da4126b..325d5af03 100644 --- a/docs/api/httpexceptions.rst +++ b/docs/api/httpexceptions.rst @@ -5,16 +5,14 @@ .. automodule:: pyramid.httpexceptions - .. autofunction:: abort - - .. autofunction:: redirect - .. attribute:: status_map A mapping of integer status code to exception class (eg. the integer "401" maps to :class:`pyramid.httpexceptions.HTTPUnauthorized`). + .. autofunction:: responsecode + .. autoclass:: HTTPException .. autoclass:: HTTPOk diff --git a/docs/api/response.rst b/docs/api/response.rst index c545b4977..e67b15568 100644 --- a/docs/api/response.rst +++ b/docs/api/response.rst @@ -8,3 +8,4 @@ .. autoclass:: Response :members: :inherited-members: + -- cgit v1.2.3 From d868fff7597c5a05acd1f5c024fc45dde9880413 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 13 Jun 2011 06:17:00 -0400 Subject: - Remove IResponder abstraction in favor of more general IResponse abstraction. - It is now possible to return an arbitrary object from a Pyramid view callable even if a renderer is not used, as long as a suitable adapter to ``pyramid.interfaces.IResponse`` is registered for the type of the returned object. See the section in the Hooks chapter of the documentation entitled "Changing How Pyramid Treats View Responses". - The Pyramid router now, by default, expects response objects returned from view callables to implement the ``pyramid.interfaces.IResponse`` interface. Unlike the Pyramid 1.0 version of this interface, objects which implement IResponse now must define a ``__call__`` method that accepts ``environ`` and ``start_response``, and which returns an ``app_iter`` iterable, among other things. Previously, it was possible to return any object which had the three WebOb ``app_iter``, ``headerlist``, and ``status`` attributes as a response, so this is a backwards incompatibility. It is possible to get backwards compatibility back by registering an adapter to IResponse from the type of object you're now returning from view callables. See the section in the Hooks chapter of the documentation entitled "Changing How Pyramid Treats View Responses". - The ``pyramid.interfaces.IResponse`` interface is now much more extensive. Previously it defined only ``app_iter``, ``status`` and ``headerlist``; now it is basically intended to directly mirror the ``webob.Response`` API, which has many methods and attributes. - Documentation changes to support above. --- docs/api/interfaces.rst | 2 +- docs/api/request.rst | 33 ++++++++++++++++++--------------- 2 files changed, 19 insertions(+), 16 deletions(-) (limited to 'docs/api') diff --git a/docs/api/interfaces.rst b/docs/api/interfaces.rst index 3a60fa4dc..51a1963b5 100644 --- a/docs/api/interfaces.rst +++ b/docs/api/interfaces.rst @@ -57,6 +57,6 @@ Other Interfaces .. autointerface:: IMultiDict :members: - .. autointerface:: IResponder + .. autointerface:: IResponse :members: diff --git a/docs/api/request.rst b/docs/api/request.rst index 8cb424658..27ce395ac 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -107,7 +107,9 @@ return {'text':'Value that will be used by the renderer'} Mutations to this response object will be preserved in the response sent - to the client after rendering. + to the client after rendering. For more information about using + ``request.response`` in conjunction with a renderer, see + :ref:`request_response_attr`. Non-renderer code can also make use of request.response instead of creating a response "by hand". For example, in view code:: @@ -162,20 +164,21 @@ .. attribute:: response_* - .. warning:: As of Pyramid 1.1, assignment to ``response_*`` attrs are - deprecated. Assigning to one will cause a deprecation warning to be - emitted. Instead of assigning ``response_*`` attributes to the - request, use API of the the :attr:`pyramid.request.Request.response` - object (exposed to view code as ``request.response``) to influence - response behavior. - - You can set attributes on a :class:`pyramid.request.Request` which will - influence the behavor of *rendered* responses (views which use a - :term:`renderer` and which don't directly return a response). These - attributes begin with ``response_``, such as ``response_headerlist``. If - you need to influence response values from a view that uses a renderer - (such as the status code, a header, the content type, etc) see, - :ref:`response_prefixed_attrs`. + In Pyramid 1.0, you could set attributes on a + :class:`pyramid.request.Request` which influenced the behavor of + *rendered* responses (views which use a :term:`renderer` and which + don't directly return a response). These attributes began with + ``response_``, such as ``response_headerlist``. If you needed to + influence response values from a view that uses a renderer (such as the + status code, a header, the content type, etc) you would set these + attributes. See :ref:`response_prefixed_attrs` for further discussion. + As of Pyramid 1.1, assignment to ``response_*`` attrs are deprecated. + Assigning to one is still supported but will cause a deprecation + warning to be emitted, and eventually the feature will be removed. For + new code, instead of assigning ``response_*`` attributes to the + request, use API of the the :attr:`pyramid.request.Request.response` + object (exposed to view code as ``request.response``) to influence + rendered response behavior. .. note:: -- cgit v1.2.3 From 1a6fc7062f803b9f15b7677db9a9257a4f00bfcb Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 14 Jun 2011 02:36:07 -0400 Subject: - Added new add_response_adapter method to Configurator. - Fix Configurator docstring wrt exception responses. - Speed up registry.queryAdapterOrSelf --- docs/api/config.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index 2b9d7bcef..274ee0292 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -40,6 +40,8 @@ .. automethod:: add_renderer(name, factory) + .. automethod:: add_response_adapter + .. automethod:: add_route .. automethod:: add_static_view(name, path, cache_max_age=3600, permission='__no_permission_required__') -- cgit v1.2.3 From f8f08bac0ea9edcac40fae2b3ad56e6a1ac7f47f Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 20 Jun 2011 00:57:30 -0400 Subject: responsecode -> exception_response --- docs/api/httpexceptions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/httpexceptions.rst b/docs/api/httpexceptions.rst index 325d5af03..89be17a2d 100644 --- a/docs/api/httpexceptions.rst +++ b/docs/api/httpexceptions.rst @@ -11,7 +11,7 @@ integer "401" maps to :class:`pyramid.httpexceptions.HTTPUnauthorized`). - .. autofunction:: responsecode + .. autofunction:: exception_response .. autoclass:: HTTPException -- cgit v1.2.3 From c1f3d0fd89eb7f62a7de365ca5c0ef5600ffd900 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 1 Jul 2011 00:59:11 -0400 Subject: Add JSONP renderer --- docs/api/renderers.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/api') diff --git a/docs/api/renderers.rst b/docs/api/renderers.rst index 459639a46..c13694219 100644 --- a/docs/api/renderers.rst +++ b/docs/api/renderers.rst @@ -11,3 +11,5 @@ .. autofunction:: render_to_response +.. autoclass:: JSONP + -- cgit v1.2.3 From b7f33b5fdd062e007723d0eb60001442f35c0bf7 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 1 Jul 2011 01:24:39 -0400 Subject: - Deprecated the ``set_renderer_globals_factory`` method of the Configurator and the ``renderer_globals`` Configurator constructor parameter. --- docs/api/config.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index 274ee0292..71ef4a746 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -74,7 +74,7 @@ .. automethod:: set_request_factory - .. automethod:: set_renderer_globals_factory + .. automethod:: set_renderer_globals_factory(factory) .. automethod:: set_view_mapper -- cgit v1.2.3 From b78effb723e5a6b2f3980dac7830f8932abd7890 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 4 Jul 2011 03:58:00 -0400 Subject: - New request attribute: ``json``. If the request's ``content_type`` is ``application/json``, this attribute will contain the JSON-decoded variant of the request body. If the request's ``content_type`` is not ``application/json``, this attribute will be ``None``. --- docs/api/request.rst | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 27ce395ac..5dfb2ae9a 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -180,6 +180,13 @@ object (exposed to view code as ``request.response``) to influence rendered response behavior. + .. attribute:: json + + If the request's ``content_type`` is ``application/json``, this + attribute will contain the JSON-decoded variant of the request body. + If the request's ``content_type`` is not ``application/json``, this + attribute will be ``None``. + .. note:: For information about the API of a :term:`multidict` structure (such as -- cgit v1.2.3 From e8561f919548e2fe17f82d98e2a13e1e4e85bf40 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Thu, 7 Jul 2011 01:57:18 -0500 Subject: Added/updated documentation for the new interactive shell. --- docs/api/paster.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'docs/api') diff --git a/docs/api/paster.rst b/docs/api/paster.rst index 9ecfa3d9c..6668f3c77 100644 --- a/docs/api/paster.rst +++ b/docs/api/paster.rst @@ -5,9 +5,12 @@ .. module:: pyramid.paster -.. function:: get_app(config_file, name) +.. function:: get_app(config_file, name=None) Return the WSGI application named ``name`` in the PasteDeploy config file ``config_file``. - + If the ``name`` is None, this will attempt to parse the name from + the ``config_file`` string expecting the format ``ini_file#name``. + If no name is found, the name will default to "main". + -- cgit v1.2.3 From 6a0602b3ce4d2a6de9dca25d8e0d390796a79267 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 9 Jul 2011 21:12:06 -0400 Subject: request.json -> request.json_body; add some docs for json_body --- docs/api/request.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 5dfb2ae9a..404825d1b 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -180,12 +180,12 @@ object (exposed to view code as ``request.response``) to influence rendered response behavior. - .. attribute:: json + .. attribute:: json_body - If the request's ``content_type`` is ``application/json``, this - attribute will contain the JSON-decoded variant of the request body. - If the request's ``content_type`` is not ``application/json``, this - attribute will be ``None``. + This property will return the JSON-decoded variant of the request + body. If the request body is not well-formed JSON, or there is no + body associated with this request, this property will raise an + exception. See also :ref:`request_json_body`. .. note:: -- cgit v1.2.3 From 0784123a4042353beedc84960bbbf51068eec295 Mon Sep 17 00:00:00 2001 From: Manuel Hermann Date: Mon, 11 Jul 2011 16:47:38 +0200 Subject: Decorator version of config.add_response_adapter. --- docs/api/response.rst | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docs/api') diff --git a/docs/api/response.rst b/docs/api/response.rst index e67b15568..8020b629a 100644 --- a/docs/api/response.rst +++ b/docs/api/response.rst @@ -9,3 +9,8 @@ :members: :inherited-members: +Functions +~~~~~~~~~ + +.. autofunction:: response_adapter + -- cgit v1.2.3 From 56d0fe4a9f97daa4d5fd0c28ea83c6ef32856b3d Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 14 Jul 2011 01:13:27 -0400 Subject: - New API class: ``pyramid.static.static_view``. This supersedes the deprecated ``pyramid.view.static`` class. ``pyramid.satic.static_view`` by default serves up documents as the result of the request's ``path_info``, attribute rather than it's ``subpath`` attribute (the inverse was true of ``pyramid.view.static``, and still is). ``pyramid.static.static_view`` exposes a ``use_subpath`` flag for use when you don't want the static view to behave like the older deprecated version. - The ``pyramid.view.static`` class has been deprecated in favor of the newer ``pyramid.static.static_view`` class. A deprecation warning is raised when it is used. You should replace it with a reference to ``pyramid.static.static_view`` with the ``use_subpath=True`` argument. --- docs/api/static.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 docs/api/static.rst (limited to 'docs/api') diff --git a/docs/api/static.rst b/docs/api/static.rst new file mode 100644 index 000000000..c28473584 --- /dev/null +++ b/docs/api/static.rst @@ -0,0 +1,11 @@ +.. _static_module: + +:mod:`pyramid.static` +--------------------- + +.. automodule:: pyramid.static + + .. autoclass:: static_view + :members: + :inherited-members: + -- cgit v1.2.3 From 37e3bebf0165ac5f32c82c0bc87296e0ca5fefd3 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Mon, 11 Jul 2011 05:40:06 -0500 Subject: Added some docs for make_request and global_registries. --- docs/api/config.rst | 10 ++++++++++ docs/api/scripting.rst | 2 ++ 2 files changed, 12 insertions(+) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index 71ef4a746..d021412b8 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -86,3 +86,13 @@ .. automethod:: testing_add_renderer + .. attribute:: global_registries + + A set of registries that have been created for :app:`Pyramid` + applications. The object itself supports iteration and has a + ``last`` property containing the last registry loaded. + + The registries contained in this object are stored as weakrefs, + thus they will only exist for the lifetime of the actual + applications for which they are being used. + diff --git a/docs/api/scripting.rst b/docs/api/scripting.rst index 9d5bc2e58..2029578ba 100644 --- a/docs/api/scripting.rst +++ b/docs/api/scripting.rst @@ -7,3 +7,5 @@ .. autofunction:: get_root + .. autofunction:: make_request + -- cgit v1.2.3 From 359906f09a389db4386984c84cc615eb1f033b8c Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Wed, 13 Jul 2011 22:33:13 -0500 Subject: Added p.scripting.get_root2 that doesn't require an app arg. --- docs/api/scripting.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/api') diff --git a/docs/api/scripting.rst b/docs/api/scripting.rst index 2029578ba..3e9a814fc 100644 --- a/docs/api/scripting.rst +++ b/docs/api/scripting.rst @@ -7,5 +7,7 @@ .. autofunction:: get_root + .. autofunction:: get_root2 + .. autofunction:: make_request -- cgit v1.2.3 From f422adb9108520182c7eee5128c0f1e1f64d2e17 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Wed, 13 Jul 2011 22:57:09 -0500 Subject: Added p.paster.bootstrap for handling simple loading of INI files. --- docs/api/paster.rst | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'docs/api') diff --git a/docs/api/paster.rst b/docs/api/paster.rst index 6668f3c77..09e768fae 100644 --- a/docs/api/paster.rst +++ b/docs/api/paster.rst @@ -3,14 +3,8 @@ :mod:`pyramid.paster` --------------------------- -.. module:: pyramid.paster +.. automodule:: pyramid.paster -.. function:: get_app(config_file, name=None) - - Return the WSGI application named ``name`` in the PasteDeploy - config file ``config_file``. - - If the ``name`` is None, this will attempt to parse the name from - the ``config_file`` string expecting the format ``ini_file#name``. - If no name is found, the name will default to "main". + .. autofunction:: get_app + .. autofunction:: bootstrap -- cgit v1.2.3 From 00f7c6abb9ed581411044e9aee2f1647cfadfcb7 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Thu, 14 Jul 2011 19:54:59 -0500 Subject: Added test coverage for p.paster.bootstrap. --- docs/api/paster.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/paster.rst b/docs/api/paster.rst index 09e768fae..2a32e07e9 100644 --- a/docs/api/paster.rst +++ b/docs/api/paster.rst @@ -5,6 +5,13 @@ .. automodule:: pyramid.paster - .. autofunction:: get_app + .. function:: get_app(config_uri, name=None) + + Return the WSGI application named ``name`` in the PasteDeploy + config file specified by ``config_uri``. + + If the ``name`` is None, this will attempt to parse the name from + the ``config_uri`` string expecting the format ``inifile#name``. + If no name is found, the name will default to "main". .. autofunction:: bootstrap -- cgit v1.2.3 From c515d77de5b2f62727251ebc32d1292e67811771 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 15 Jul 2011 10:13:07 -0400 Subject: - get_root2 -> prepare - change prepare return value to a dict, and return the registry, request, etc - various docs and changelog entries. --- docs/api/config.rst | 8 +++++--- docs/api/scripting.rst | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index d021412b8..2c394ac41 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -88,9 +88,11 @@ .. attribute:: global_registries - A set of registries that have been created for :app:`Pyramid` - applications. The object itself supports iteration and has a - ``last`` property containing the last registry loaded. + The set of registries that have been created for :app:`Pyramid` + applications, one per each call to + :meth:`pyramid.config.Configurator.make_app` in the current process. The + object itself supports iteration and has a ``last`` property containing + the last registry loaded. The registries contained in this object are stored as weakrefs, thus they will only exist for the lifetime of the actual diff --git a/docs/api/scripting.rst b/docs/api/scripting.rst index 3e9a814fc..79136a98b 100644 --- a/docs/api/scripting.rst +++ b/docs/api/scripting.rst @@ -7,7 +7,7 @@ .. autofunction:: get_root - .. autofunction:: get_root2 + .. autofunction:: prepare .. autofunction:: make_request -- cgit v1.2.3 From 7a5f5612791210081db430aa707ed146a8e2c0e9 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 15 Jul 2011 15:40:53 -0400 Subject: remove bogus information about route_name, refer to the right method of Configurator when describing global_registries, add http_cache newness warning --- docs/api/config.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index 2c394ac41..96e955388 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -90,9 +90,9 @@ The set of registries that have been created for :app:`Pyramid` applications, one per each call to - :meth:`pyramid.config.Configurator.make_app` in the current process. The - object itself supports iteration and has a ``last`` property containing - the last registry loaded. + :meth:`pyramid.config.Configurator.make_wsgi_app` in the current + process. The object itself supports iteration and has a ``last`` + property containing the last registry loaded. The registries contained in this object are stored as weakrefs, thus they will only exist for the lifetime of the actual -- cgit v1.2.3 From 8ac4c95d9f8bb32891c21b483474e402ff1c27fe Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Sat, 16 Jul 2011 15:19:44 -0500 Subject: Reworked pyramid.scripting. Modified docs and made make_request private. Renamed make_request to _make_request to make clear that it's not a private API. p.scripting.prepare now raises an exception if no valid pyramid app can be found to avoid obscure errors later on. --- docs/api/scripting.rst | 2 -- 1 file changed, 2 deletions(-) (limited to 'docs/api') diff --git a/docs/api/scripting.rst b/docs/api/scripting.rst index 79136a98b..51bd3c7a0 100644 --- a/docs/api/scripting.rst +++ b/docs/api/scripting.rst @@ -9,5 +9,3 @@ .. autofunction:: prepare - .. autofunction:: make_request - -- cgit v1.2.3 From aa2fe1b0a02ba4edde4d285ec0a5a6ec545b7fec Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 21 Jul 2011 22:02:37 -0400 Subject: - Added the ``pyramid.renderers.null_renderer`` object as an API. The null renderer is an object that can be used in advanced integration cases as input to the view configuration ``renderer=`` argument. When the null renderer is used as a view renderer argument, Pyramid avoids converting the view callable result into a Response object. This is useful if you want to reuse the view configuration and lookup machinery outside the context of its use by the Pyramid router. This feature was added for consumption by the ``pyramid_rpc`` package, which uses view configuration and lookup outside the context of a router in exactly this way. ``pyramid_rpc`` has been broken under 1.1 since 1.1b1; adding it allows us to make it work again. --- docs/api/renderers.rst | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'docs/api') diff --git a/docs/api/renderers.rst b/docs/api/renderers.rst index c13694219..15670c46e 100644 --- a/docs/api/renderers.rst +++ b/docs/api/renderers.rst @@ -13,3 +13,12 @@ .. autoclass:: JSONP +.. attribute:: null_renderer + + An object that can be used in advanced integration cases as input to the + view configuration ``renderer=`` argument. When the null renderer is used + as a view renderer argument, Pyramid avoids converting the view callable + result into a Response object. This is useful if you want to reuse the + view configuration and lookup machinery outside the context of its use by + the Pyramid router (e.g. the package named ``pyramid_rpc`` does this). + -- cgit v1.2.3 From b723792bfc43dc3d4446837c48d78c9258697e6d Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 23 Jul 2011 19:57:34 -0400 Subject: - New method: ``pyramid.request.Request.add_view_mapper``. A view wrapper is used to wrap the found view callable before it is called by Pyramid's router. This is a feature usually only used by framework extensions, to provide, for example, view timing support. A view wrapper factory must be a callable which accepts three arguments: ``view_callable``, ``request``, and ``exc``. It must return a view callable. The view callable returned by the factory must implement the ``context, request`` view callable calling convention. For example:: import time def wrapper_factory(view_callable, request, exc): def wrapper(context, request): start = time.time() result = view_callable(context, request) end = time.time() request.view_timing = end - start return result return wrapper The ``view_callable`` argument to the factory will be the view callable found by Pyramid via view lookup. The ``request`` argument to the factory will be the current request. The ``exc`` argument to the factory will be an Exception object if the found view is an exception view; it will be ``None`` otherwise. View wrappers only last for the duration of a single request. You can add such a factory for every request by using the ``pyramid.events.NewRequest`` subscriber:: from pyramid.events import subscriber, NewRequest @subscriber(NewRequest) def newrequest(event): event.request.add_view_wrapper(wrapper_factory) If more than one view wrapper is registered during a single request, a 'later' view wrapper factory will be called with the result of its directly former view wrapper factory as its ``view_callable`` argument; this chain will be returned to Pyramid as a single view callable. --- docs/api/request.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 404825d1b..58532bbd1 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -154,6 +154,8 @@ .. automethod:: add_finished_callback + .. automethod:: add_view_wrapper + .. automethod:: route_url .. automethod:: route_path -- cgit v1.2.3 From af2323bcb169653dd2d76d7c40909fd881041beb Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 24 Jul 2011 01:01:38 -0400 Subject: first cut --- docs/api/config.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index 96e955388..21e2b828d 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -78,6 +78,8 @@ .. automethod:: set_view_mapper + .. automethod:: add_request_handler + .. automethod:: testing_securitypolicy .. automethod:: testing_resources -- cgit v1.2.3 From 6434998267a4930fd9175df06b9a07d83937b71d Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 24 Jul 2011 01:05:56 -0400 Subject: back this feature out; we'll try a different approach --- docs/api/request.rst | 2 -- 1 file changed, 2 deletions(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 58532bbd1..404825d1b 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -154,8 +154,6 @@ .. automethod:: add_finished_callback - .. automethod:: add_view_wrapper - .. automethod:: route_url .. automethod:: route_path -- cgit v1.2.3 From 95a3791409f4a936c47e7018e75f14fc3b701380 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 31 Jul 2011 03:57:06 -0400 Subject: - A new attribute is available on request objects: ``exc_info``. Its value will be ``None`` until an exception is caught by the Pyramid router, after which it will be the result of ``sys.exc_info()``. --- docs/api/request.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 404825d1b..2ab3977d5 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -85,6 +85,17 @@ of ``request.exception`` will be ``None`` within response and finished callbacks. + .. attribute:: exc_info + + If an exception was raised by a :term:`root factory` or a :term:`view + callable`, or at various other points where :app:`Pyramid` executes + user-defined code during the processing of a request, result of + ``sys.exc_info()`` will be available as the ``exc_info`` attribute of + the request within a :term:`exception view`, a :term:`response callback` + or a :term:`finished callback`. If no exception occurred, the value of + ``request.exc_info`` will be ``None`` within response and finished + callbacks. + .. attribute:: response This attribute is actually a "reified" property which returns an -- cgit v1.2.3 From 1311321d454ded6226b09f929ebc9e4aa2c12771 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 6 Aug 2011 18:58:26 -0400 Subject: add tweens module, add docs for ptweens and tweens to hooks --- docs/api/config.rst | 2 +- docs/api/tweens.rst | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 docs/api/tweens.rst (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index 21e2b828d..1a9bb6ba4 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -78,7 +78,7 @@ .. automethod:: set_view_mapper - .. automethod:: add_request_handler + .. automethod:: add_tween .. automethod:: testing_securitypolicy diff --git a/docs/api/tweens.rst b/docs/api/tweens.rst new file mode 100644 index 000000000..5fc15cb00 --- /dev/null +++ b/docs/api/tweens.rst @@ -0,0 +1,8 @@ +.. _tweens_module: + +:mod:`pyramid.tweens` +--------------------- + +.. automodule:: pyramid.tweens + + .. autofunction:: excview_tween_factory -- cgit v1.2.3 From 05f610e6ed66f8d5aca9d77ae0748feb0c8f8479 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 8 Aug 2011 23:26:59 -0400 Subject: document under and over params --- docs/api/tweens.rst | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'docs/api') diff --git a/docs/api/tweens.rst b/docs/api/tweens.rst index 5fc15cb00..ddacd2cde 100644 --- a/docs/api/tweens.rst +++ b/docs/api/tweens.rst @@ -6,3 +6,20 @@ .. automodule:: pyramid.tweens .. autofunction:: excview_tween_factory + + .. attribute:: MAIN + + Constant representing the main Pyramid handling function, for use in + ``under`` and ``over`` arguments to + :meth:`pyramid.config.Configurator.add_tween`. + + .. attribute:: INGRESS + + Constant representing the request ingress, for use in ``under`` and + ``over`` arguments to :meth:`pyramid.config.Configurator.add_tween`. + + .. attribute:: EXCVIEW + + Constant representing the exception view tween, for use in ``under`` + and ``over`` arguments to + :meth:`pyramid.config.Configurator.add_tween`. -- cgit v1.2.3 From 7d75b9711290da353077d87323ba0ccc1c1918ab Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 10 Aug 2011 00:01:48 -0400 Subject: show members for event interfaces --- docs/api/interfaces.rst | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docs/api') diff --git a/docs/api/interfaces.rst b/docs/api/interfaces.rst index 51a1963b5..9ab9eefc3 100644 --- a/docs/api/interfaces.rst +++ b/docs/api/interfaces.rst @@ -9,14 +9,19 @@ Event-Related Interfaces ++++++++++++++++++++++++ .. autointerface:: IApplicationCreated + :members: .. autointerface:: INewRequest + :members: .. autointerface:: IContextFound + :members: .. autointerface:: INewResponse + :members: .. autointerface:: IBeforeRender + :members: Other Interfaces ++++++++++++++++ -- cgit v1.2.3 From fecefff5f0c3a6aaafdd43d902aaed15edb8559e Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Tue, 9 Aug 2011 23:26:12 -0500 Subject: Added the `pyramid.security.NO_PERMISSION_REQUIRED` constant. Removed the undocumented version from pyramid.interfaces. --- docs/api/config.rst | 2 +- docs/api/security.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index 1a9bb6ba4..30c541905 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -44,7 +44,7 @@ .. automethod:: add_route - .. automethod:: add_static_view(name, path, cache_max_age=3600, permission='__no_permission_required__') + .. automethod:: add_static_view(name, path, cache_max_age=3600, permission=NO_PERMISSION_REQUIRED) .. automethod:: add_settings diff --git a/docs/api/security.rst b/docs/api/security.rst index de249355d..8cd9e5dae 100644 --- a/docs/api/security.rst +++ b/docs/api/security.rst @@ -57,6 +57,8 @@ Constants last ACE in an ACL in systems that use an "inheriting" security policy, representing the concept "don't inherit any other ACEs". +.. attribute:: NO_PERMISSION_REQUIRED + Return Values ------------- -- cgit v1.2.3 From 5c52daef7004a1e43a7c2fc25613e3d92c4b6b8e Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 14 Aug 2011 00:53:53 -0400 Subject: - Added the ``pyramid.interfaces.IDict`` interface representing the methods of a dictionary, for documentation purposes only (IMultiDict and IBeforeRender inherit from it). - Previously the ``pyramid.events.BeforeRender`` event *wrapped* a dictionary (it addressed it as its ``_system`` attribute). Now it *is* a dictionary (it inherits from ``dict``), and it's the value that is passed to templates as a top-level dictionary. --- docs/api/events.rst | 9 +++++++++ docs/api/interfaces.rst | 3 +++ 2 files changed, 12 insertions(+) (limited to 'docs/api') diff --git a/docs/api/events.rst b/docs/api/events.rst index 59657a820..31a0e22c1 100644 --- a/docs/api/events.rst +++ b/docs/api/events.rst @@ -25,6 +25,15 @@ Event Types .. autoclass:: BeforeRender :members: + :inherited-members: + :exclude-members: update + + .. method:: update(E, **F) + + Update D from dict/iterable E and F. If E has a .keys() method, does: + for k in E: D[k] = E[k] If E lacks .keys() method, does: for (k, v) in + E: D[k] = v. In either case, this is followed by: for k in F: D[k] = + F[k]. See :ref:`events_chapter` for more information about how to register code which subscribes to these events. diff --git a/docs/api/interfaces.rst b/docs/api/interfaces.rst index 9ab9eefc3..b336e549d 100644 --- a/docs/api/interfaces.rst +++ b/docs/api/interfaces.rst @@ -59,6 +59,9 @@ Other Interfaces .. autointerface:: IViewMapper :members: + .. autointerface:: IDict + :members: + .. autointerface:: IMultiDict :members: -- cgit v1.2.3 From 1a42bd45ad6dd066078d6d4997d33208b1bd0c63 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 15 Aug 2011 03:01:51 -0400 Subject: - New methods of the ``pyramid.config.Configurator`` class: ``set_authentication_policy`` and ``set_authorization_policy``. These are meant to be consumed mostly by add-on authors. --- docs/api/config.rst | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index 30c541905..de054d7ce 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -78,6 +78,10 @@ .. automethod:: set_view_mapper + .. automethod:: set_authentication_policy + + .. automethod:: set_authorization_policy + .. automethod:: add_tween .. automethod:: testing_securitypolicy -- cgit v1.2.3 From ea824f6f1ceaae4b922b6cff5320bb1c19cbacd5 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 18 Aug 2011 22:15:11 -0400 Subject: - Pyramid no longer eagerly commits some default configuration statements at Configurator construction time, which permits values passed in as constructor arguments (e.g. ``authentication_policy`` and ``authorization_policy``) to override the same settings obtained via an "include". --- docs/api/config.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index de054d7ce..d744418b3 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -54,6 +54,8 @@ .. automethod:: add_view + .. automethod:: add_tween + .. automethod:: derive_view .. automethod:: make_wsgi_app() @@ -74,6 +76,8 @@ .. automethod:: set_request_factory + .. automethod:: set_root_factory + .. automethod:: set_renderer_globals_factory(factory) .. automethod:: set_view_mapper @@ -82,8 +86,6 @@ .. automethod:: set_authorization_policy - .. automethod:: add_tween - .. automethod:: testing_securitypolicy .. automethod:: testing_resources -- cgit v1.2.3 From adfc236ef6b448de6970d5c9db53bf40eab6e056 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 19 Aug 2011 09:20:29 -0400 Subject: review and fix configurator docs in random places --- docs/api/config.rst | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index d744418b3..a8c193b60 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -5,7 +5,7 @@ .. automodule:: pyramid.config - .. autoclass:: Configurator(registry=None, package=None, settings=None, root_factory=None, authentication_policy=None, authorization_policy=None, renderers=DEFAULT_RENDERERS, debug_logger=None, locale_negotiator=None, request_factory=None, renderer_globals_factory=None, default_permission=None, session_factory=None, autocommit=False) + .. autoclass:: Configurator .. attribute:: registry @@ -36,9 +36,9 @@ .. automethod:: absolute_asset_spec - .. automethod:: setup_registry(settings=None, root_factory=None, authentication_policy=None, renderers=DEFAULT_RENDERERS, debug_logger=None, locale_negotiator=None, request_factory=None, renderer_globals_factory=None) + .. automethod:: setup_registry - .. automethod:: add_renderer(name, factory) + .. automethod:: add_renderer .. automethod:: add_response_adapter @@ -64,10 +64,6 @@ .. automethod:: scan - .. automethod:: set_forbidden_view - - .. automethod:: set_notfound_view - .. automethod:: set_locale_negotiator .. automethod:: set_default_permission @@ -78,8 +74,6 @@ .. automethod:: set_root_factory - .. automethod:: set_renderer_globals_factory(factory) - .. automethod:: set_view_mapper .. automethod:: set_authentication_policy @@ -94,6 +88,13 @@ .. automethod:: testing_add_renderer + .. automethod:: set_forbidden_view + + .. automethod:: set_notfound_view + + .. automethod:: set_renderer_globals_factory(factory) + + .. attribute:: global_registries The set of registries that have been created for :app:`Pyramid` -- cgit v1.2.3 From 12cef0ee3526d7a024b9c328fd75e64565f02519 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 20 Aug 2011 11:34:16 -0400 Subject: - New request methods: ``current_route_url``, ``current_route_path``. - New function in ``pyramid.url``: ``current_route_path``. --- docs/api/request.rst | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 2ab3977d5..c7dc897a3 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -167,8 +167,12 @@ .. automethod:: route_url + .. automethod:: current_route_url + .. automethod:: route_path + .. automethod:: current_route_path + .. automethod:: resource_url .. automethod:: static_url -- cgit v1.2.3 From 5c6963152fcc756a06d2aea80a4e85f1c9bef7ee Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 20 Aug 2011 12:06:19 -0400 Subject: add static_path function to url and static_path method to request --- docs/api/request.rst | 10 ++++++---- docs/api/url.rst | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index c7dc897a3..642e6c84f 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -167,16 +167,18 @@ .. automethod:: route_url - .. automethod:: current_route_url - .. automethod:: route_path - .. automethod:: current_route_path + .. automethod:: current_route_url - .. automethod:: resource_url + .. automethod:: current_route_path .. automethod:: static_url + .. automethod:: static_path + + .. automethod:: resource_url + .. attribute:: response_* In Pyramid 1.0, you could set attributes on a diff --git a/docs/api/url.rst b/docs/api/url.rst index 01be76283..131d85806 100644 --- a/docs/api/url.rst +++ b/docs/api/url.rst @@ -13,7 +13,11 @@ .. autofunction:: route_path + .. autofunction:: current_route_path + .. autofunction:: static_url + .. autofunction:: static_path + .. autofunction:: urlencode -- cgit v1.2.3 From 596860a10e8356e72aa695f77c3c8c4dbf269c52 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Thu, 25 Aug 2011 02:34:57 -0500 Subject: Added docs for some missing HTTP status' supported in httpexceptions. --- docs/api/httpexceptions.rst | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'docs/api') diff --git a/docs/api/httpexceptions.rst b/docs/api/httpexceptions.rst index 89be17a2d..6a08d1048 100644 --- a/docs/api/httpexceptions.rst +++ b/docs/api/httpexceptions.rst @@ -87,6 +87,12 @@ .. autoclass:: HTTPExpectationFailed + .. autoclass:: HTTPUnprocessableEntity + + .. autoclass:: HTTPLocked + + .. autoclass:: HTTPFailedDependency + .. autoclass:: HTTPInternalServerError .. autoclass:: HTTPNotImplemented @@ -98,3 +104,5 @@ .. autoclass:: HTTPGatewayTimeout .. autoclass:: HTTPVersionNotSupported + + .. autoclass:: HTTPInsufficientStorage -- cgit v1.2.3 From 1dd5ab89c13d0480e863aa7853d35c7f5492f5e1 Mon Sep 17 00:00:00 2001 From: Daniel Haaker Date: Mon, 12 Sep 2011 21:58:19 +0200 Subject: explain NO_PERMISSION_REQUIRED constant in API docs --- docs/api/security.rst | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'docs/api') diff --git a/docs/api/security.rst b/docs/api/security.rst index 8cd9e5dae..7086690e9 100644 --- a/docs/api/security.rst +++ b/docs/api/security.rst @@ -59,6 +59,12 @@ Constants .. attribute:: NO_PERMISSION_REQUIRED + A special permission which indicates that the view should always + be executable by entirely anonymous users, regardless of the + default permission, bypassing any :term:`authorization policy` + that may be in effect. Its actual value is the string + '__no_permission_required__'. + Return Values ------------- -- cgit v1.2.3 From 5cf9fc8ab86e6ec6b76dd9d80cd8dcab42384cc6 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 11 Nov 2011 13:38:32 -0500 Subject: - New ``pyramid.compat`` module and API documentation which provides Python 2/3 straddling support for Pyramid add-ons and development environments. --- docs/api/compat.rst | 155 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 docs/api/compat.rst (limited to 'docs/api') diff --git a/docs/api/compat.rst b/docs/api/compat.rst new file mode 100644 index 000000000..cb8cf918f --- /dev/null +++ b/docs/api/compat.rst @@ -0,0 +1,155 @@ +.. _compat_module: + +:mod:`pyramid.compat` +---------------------- + +The ``pyramid.compat`` module provides platform and version compatibility for +Pyramid and its add-ons across Python platform and version differences. APIs +will be removed from this module over time as Pyramid ceases to support +systems which require compatibility imports. + +.. automodule:: pyramid.compat + + .. attribute:: PYPY + + ``True`` if running on PyPy, ``False`` otherwise. + + .. attribute:: PY3 + + ``True`` if running on Python 3, ``False`` otherwise. + + .. attribute:: pickle + + ``cPickle`` module if it exists, ``pickle`` module otherwise. + + .. attribute:: im_func + + On Python 2, the string value ``im_func``, on Python 3, the string + value ``__func__``. + + .. attribute:: configparser + + On Python 2, the ``ConfigParser`` module, on Python 3, the + ``configparser`` module. + + .. attribute:: SimpleCookie + + On Python 2, the ``Cookie.SimpleCookie`` class, on Python 3, the + ``http.cookies.SimpleCookie`` module. + + .. attribute:: string_types + + Sequence of string types for this platform. For Python 3, it's + ``(str,)``. For Python 2, it's ``(basestring,)``. + + .. attribute:: integer_types + + Sequence of integer types for this platform. For Python 3, it's + ``(int,)``. For Python 2, it's ``(int, long)``. + + .. attribute:: class_types + + Sequence of class types for this platform. For Python 3, it's + ``(type,)``. For Python 2, it's ``(type, types.ClassType)``. + + .. attribute:: text_type + + Text type for this platform. For Python 3, it's ``str``. For Python + 2, it's ``unicode``. + + .. attribute:: binary_type + + Binary type for this platform. For Python 3, it's ``bytes``. For + Python 2, it's ``str``. + + .. attribute:: long + + Long type for this platform. For Python 3, it's ``int``. For + Python 2, it's ``long``. + + .. autofunction:: text_ + + .. autofunction:: bytes_ + + .. autofunction:: ascii_native_ + + .. autofunction:: native_ + + .. attribute:: urlparse + + ``urlparse`` module on Python 2, ``urllib.parse`` module on Python 3. + + .. attribute:: url_quote + + ``urllib.quote`` function on Python 2, ``urllib.parse.quote`` function + on Python 3. + + .. attribute:: url_quote_plus + + ``urllib.quote_plus`` function on Python 2, ``urllib.parse.quote_plus`` + function on Python 3. + + .. attribute:: url_unquote + + ``urllib.unquote`` function on Python 2, ``urllib.parse.unquote`` + function on Python 3. + + .. attribute:: url_encode + + ``urllib.urlencode`` function on Python 2, ``urllib.parse.urlencode`` + function on Python 3. + + .. attribute:: url_open + + ``urllib2.urlopen`` function on Python 2, ``urllib.request.urlopen`` + function on Python 3. + + .. function:: url_unquote_text(v, encoding='utf-8', errors='replace') + + On Python 2, return ``url_unquote(v).decode(encoding(encoding, errors))``; + on Python 3, return the result of ``urllib.parse.unquote``. + + .. function:: url_unquote_native(v, encoding='utf-8', errors='replace') + + On Python 2, return ``native_(url_unquote_text_v, encoding, errors))``; + on Python 3, return the result of ``urllib.parse.unquote``. + + .. function:: reraise(tp, value, tb=None) + + Reraise an exception in a compatible way on both Python 2 and Python 3, + e.g. ``reraise(*sys.exc_info())``. + + .. function:: exec_(code, globs=None, locs=None) + + Exec code in a compatible way on both Python 2 and 3. + + .. function:: iteritems_(d) + + Return ``d.items()`` on Python 3, ``d.iteritems()`` on Python 2. + + .. function:: itervalues_(d) + + Return ``d.values()`` on Python 3, ``d.itervalues()`` on Python 2. + + .. function:: iterkeys_(d) + + Return ``d.keys()`` on Python 3, ``d.iterkeys()`` on Python 2. + + .. function:: map_(v) + + Return ``list(map(v))`` on Python 3, ``map(v)`` on Python 2. + + .. function:: is_nonstr_iter(v) + + Return ``True`` if ``v`` is a non-``str`` iterable on both Python 2 and + Python 3. + + .. function:: escape(v) + + On Python 2, the ``cgi.escape`` function, on Python 3, the + ``html.escape`` function. + + .. function:: input_(v) + + On Python 2, the ``raw_input`` function, on Python 3, the + ``input`` function. -- cgit v1.2.3 From 09f3bd21398b329de6d214dd62926d7032c3c7cb Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 11 Nov 2011 13:46:46 -0500 Subject: alphabetize --- docs/api/compat.rst | 139 ++++++++++++++++++++++++++-------------------------- 1 file changed, 70 insertions(+), 69 deletions(-) (limited to 'docs/api') diff --git a/docs/api/compat.rst b/docs/api/compat.rst index cb8cf918f..bb34f38e4 100644 --- a/docs/api/compat.rst +++ b/docs/api/compat.rst @@ -10,68 +10,108 @@ systems which require compatibility imports. .. automodule:: pyramid.compat - .. attribute:: PYPY - - ``True`` if running on PyPy, ``False`` otherwise. - - .. attribute:: PY3 - - ``True`` if running on Python 3, ``False`` otherwise. + .. autofunction:: ascii_native_ - .. attribute:: pickle + .. attribute:: binary_type - ``cPickle`` module if it exists, ``pickle`` module otherwise. + Binary type for this platform. For Python 3, it's ``bytes``. For + Python 2, it's ``str``. - .. attribute:: im_func + .. autofunction:: bytes_ + + .. attribute:: class_types - On Python 2, the string value ``im_func``, on Python 3, the string - value ``__func__``. + Sequence of class types for this platform. For Python 3, it's + ``(type,)``. For Python 2, it's ``(type, types.ClassType)``. .. attribute:: configparser On Python 2, the ``ConfigParser`` module, on Python 3, the ``configparser`` module. - .. attribute:: SimpleCookie + .. function:: escape(v) - On Python 2, the ``Cookie.SimpleCookie`` class, on Python 3, the - ``http.cookies.SimpleCookie`` module. + On Python 2, the ``cgi.escape`` function, on Python 3, the + ``html.escape`` function. - .. attribute:: string_types + .. function:: exec_(code, globs=None, locs=None) - Sequence of string types for this platform. For Python 3, it's - ``(str,)``. For Python 2, it's ``(basestring,)``. + Exec code in a compatible way on both Python 2 and 3. + + .. attribute:: im_func + + On Python 2, the string value ``im_func``, on Python 3, the string + value ``__func__``. + + .. function:: input_(v) + + On Python 2, the ``raw_input`` function, on Python 3, the + ``input`` function. .. attribute:: integer_types Sequence of integer types for this platform. For Python 3, it's ``(int,)``. For Python 2, it's ``(int, long)``. - .. attribute:: class_types + .. function:: is_nonstr_iter(v) - Sequence of class types for this platform. For Python 3, it's - ``(type,)``. For Python 2, it's ``(type, types.ClassType)``. + Return ``True`` if ``v`` is a non-``str`` iterable on both Python 2 and + Python 3. - .. attribute:: text_type + .. function:: iteritems_(d) - Text type for this platform. For Python 3, it's ``str``. For Python - 2, it's ``unicode``. + Return ``d.items()`` on Python 3, ``d.iteritems()`` on Python 2. - .. attribute:: binary_type + .. function:: itervalues_(d) - Binary type for this platform. For Python 3, it's ``bytes``. For - Python 2, it's ``str``. + Return ``d.values()`` on Python 3, ``d.itervalues()`` on Python 2. + + .. function:: iterkeys_(d) + + Return ``d.keys()`` on Python 3, ``d.iterkeys()`` on Python 2. .. attribute:: long Long type for this platform. For Python 3, it's ``int``. For Python 2, it's ``long``. + .. function:: map_(v) + + Return ``list(map(v))`` on Python 3, ``map(v)`` on Python 2. + + .. attribute:: pickle + + ``cPickle`` module if it exists, ``pickle`` module otherwise. + + .. attribute:: PY3 + + ``True`` if running on Python 3, ``False`` otherwise. + + .. attribute:: PYPY + + ``True`` if running on PyPy, ``False`` otherwise. + + .. function:: reraise(tp, value, tb=None) + + Reraise an exception in a compatible way on both Python 2 and Python 3, + e.g. ``reraise(*sys.exc_info())``. + + .. attribute:: string_types + + Sequence of string types for this platform. For Python 3, it's + ``(str,)``. For Python 2, it's ``(basestring,)``. + + .. attribute:: SimpleCookie + + On Python 2, the ``Cookie.SimpleCookie`` class, on Python 3, the + ``http.cookies.SimpleCookie`` module. + .. autofunction:: text_ - .. autofunction:: bytes_ - - .. autofunction:: ascii_native_ + .. attribute:: text_type + + Text type for this platform. For Python 3, it's ``str``. For Python + 2, it's ``unicode``. .. autofunction:: native_ @@ -114,42 +154,3 @@ systems which require compatibility imports. On Python 2, return ``native_(url_unquote_text_v, encoding, errors))``; on Python 3, return the result of ``urllib.parse.unquote``. - .. function:: reraise(tp, value, tb=None) - - Reraise an exception in a compatible way on both Python 2 and Python 3, - e.g. ``reraise(*sys.exc_info())``. - - .. function:: exec_(code, globs=None, locs=None) - - Exec code in a compatible way on both Python 2 and 3. - - .. function:: iteritems_(d) - - Return ``d.items()`` on Python 3, ``d.iteritems()`` on Python 2. - - .. function:: itervalues_(d) - - Return ``d.values()`` on Python 3, ``d.itervalues()`` on Python 2. - - .. function:: iterkeys_(d) - - Return ``d.keys()`` on Python 3, ``d.iterkeys()`` on Python 2. - - .. function:: map_(v) - - Return ``list(map(v))`` on Python 3, ``map(v)`` on Python 2. - - .. function:: is_nonstr_iter(v) - - Return ``True`` if ``v`` is a non-``str`` iterable on both Python 2 and - Python 3. - - .. function:: escape(v) - - On Python 2, the ``cgi.escape`` function, on Python 3, the - ``html.escape`` function. - - .. function:: input_(v) - - On Python 2, the ``raw_input`` function, on Python 3, the - ``input`` function. -- cgit v1.2.3 From a735d65d1d28af75371307c3d9bb52b18ee44ef0 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Wed, 9 Nov 2011 17:11:03 -0600 Subject: Made pyramid.settings.aslist public. --- docs/api/settings.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/api') diff --git a/docs/api/settings.rst b/docs/api/settings.rst index ac1cd3f9c..6b12c038c 100644 --- a/docs/api/settings.rst +++ b/docs/api/settings.rst @@ -9,4 +9,6 @@ .. autofunction:: asbool + .. autofunction:: aslist + -- cgit v1.2.3 From 38e4c7d6b0a51a92747e6c928599a7d651362c6c Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 27 Nov 2011 00:00:55 -0500 Subject: add get_appsettings API to paster --- docs/api/paster.rst | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'docs/api') diff --git a/docs/api/paster.rst b/docs/api/paster.rst index 2a32e07e9..5cf8bbe2c 100644 --- a/docs/api/paster.rst +++ b/docs/api/paster.rst @@ -5,13 +5,9 @@ .. automodule:: pyramid.paster - .. function:: get_app(config_uri, name=None) + .. autofunction:: bootstrap - Return the WSGI application named ``name`` in the PasteDeploy - config file specified by ``config_uri``. + .. autofunction:: get_app(config_uri, name=None) - If the ``name`` is None, this will attempt to parse the name from - the ``config_uri`` string expecting the format ``inifile#name``. - If no name is found, the name will default to "main". + .. autofunction:: get_appsettings(config_uri, name=None) - .. autofunction:: bootstrap -- cgit v1.2.3 From 596495de4aa1ab0f3a3752d21c14ac08631e8457 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 27 Nov 2011 00:42:14 -0500 Subject: - Added ``setup_logging`` API function to the ``pyramid.paster`` module. This function sets up Python logging according to the logging configuration in a PasteDeploy ini file. --- docs/api/paster.rst | 1 + 1 file changed, 1 insertion(+) (limited to 'docs/api') diff --git a/docs/api/paster.rst b/docs/api/paster.rst index 5cf8bbe2c..3f7a1c364 100644 --- a/docs/api/paster.rst +++ b/docs/api/paster.rst @@ -11,3 +11,4 @@ .. autofunction:: get_appsettings(config_uri, name=None) + .. autofunction:: setup_logging(config_uri) -- cgit v1.2.3 From ce5c42f1b832b21405ffd40f61c74a5cfa040e8d Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 28 Nov 2011 20:27:14 -0500 Subject: docs --- docs/api/config.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index a8c193b60..9f130b7dc 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -94,6 +94,16 @@ .. automethod:: set_renderer_globals_factory(factory) + .. attribute:: introspector + + The :term:`introspector` associated with this configuration. + + .. attribute:: introspectable + + A shortcut attribute which points to the + :class:`pyramid.registry.Introspectable` class (used during + directives to provide introspection to actions). + .. attribute:: global_registries -- cgit v1.2.3 From 57a0d7765c54031e6ac83881b536712316f22c45 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 30 Nov 2011 12:55:41 -0500 Subject: docs; todo; coverage for Introspector --- docs/api/config.rst | 15 +++++++++++---- docs/api/interfaces.rst | 6 ++++++ docs/api/registry.rst | 25 +++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 4 deletions(-) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index 9f130b7dc..dbfbb1761 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -94,16 +94,23 @@ .. automethod:: set_renderer_globals_factory(factory) - .. attribute:: introspector - - The :term:`introspector` associated with this configuration. - .. attribute:: introspectable A shortcut attribute which points to the :class:`pyramid.registry.Introspectable` class (used during directives to provide introspection to actions). + This attribute is new as of :app:`Pyramid` 1.3. + + .. attribute:: introspector + + The :term:`introspector` related to this configuration. It is an + instance implementing the :class:`pyramid.interfaces.IIntrospector` + interface. If the Configurator constructor was supplied with an + ``introspector`` argument, this attribute will be that value. + Otherwise, it will be an instance of a default introspector type. + + This attribute is new as of :app:`Pyramid` 1.3. .. attribute:: global_registries diff --git a/docs/api/interfaces.rst b/docs/api/interfaces.rst index b336e549d..64f2773d3 100644 --- a/docs/api/interfaces.rst +++ b/docs/api/interfaces.rst @@ -68,3 +68,9 @@ Other Interfaces .. autointerface:: IResponse :members: + .. autointerface:: IIntrospectable + :members: + + .. autointerface:: IIntrospector + :members: + diff --git a/docs/api/registry.rst b/docs/api/registry.rst index 4d327370a..3dbf73a67 100644 --- a/docs/api/registry.rst +++ b/docs/api/registry.rst @@ -14,3 +14,28 @@ accessed as ``request.registry.settings`` or ``config.registry.settings`` in a typical Pyramid application. + .. attribute:: introspector + + When a registry is set up (or created) by a :term:`Configurator`, the + registry will be decorated with an instance named ``introspector`` + implementing the :class:`pyramid.interfaces.IIntrospector` interface. + See also :attr:`pyramid.config.Configurator.introspector``. + + When a registry is created "by hand", however, this attribute will not + exist until set up by a configurator. + + This attribute is often accessed as ``request.registry.introspector`` in + a typical Pyramid application. + + This attribute is new as of :app:`Pyramid` 1.3. + +.. class:: Introspectable + + The default implementation of the interface + :class:`pyramid.interfaces.IIntrospectable` used by framework exenders. + An instance of this class is is created when + :attr:`pyramid.config.Configurator.introspectable` is called. + + This class is new as of :app:`Pyramid` 1.3. + + -- cgit v1.2.3 From 57a9d679eb78e774c271bf68f6e805dc2b8186c4 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 30 Nov 2011 13:55:02 -0500 Subject: add tests for introspectable; add more interface docs and expose actioninfo --- docs/api/interfaces.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/api') diff --git a/docs/api/interfaces.rst b/docs/api/interfaces.rst index 64f2773d3..5b190b53b 100644 --- a/docs/api/interfaces.rst +++ b/docs/api/interfaces.rst @@ -74,3 +74,5 @@ Other Interfaces .. autointerface:: IIntrospector :members: + .. autointerface:: IActionInfo + :members: -- cgit v1.2.3 From b40fb8b26fe37102b076cd2310ea7a3fe8b79311 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 3 Dec 2011 21:04:24 -0500 Subject: add a noop introspector (allow introspection to be turned off) --- docs/api/registry.rst | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docs/api') diff --git a/docs/api/registry.rst b/docs/api/registry.rst index 3dbf73a67..25192f3ed 100644 --- a/docs/api/registry.rst +++ b/docs/api/registry.rst @@ -38,4 +38,9 @@ This class is new as of :app:`Pyramid` 1.3. +.. class:: noop_introspector + + An introspector which throws away all registrations, useful for disabling + introspection altogether (pass as ``introspector`` to the + :term:`Configurator` constructor). -- cgit v1.2.3 From d83b3943474d2eb01b0fd8c1be31c50553fd4384 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 5 Dec 2011 01:41:04 -0500 Subject: add whatsnew-1.3; garden --- docs/api/registry.rst | 1 + 1 file changed, 1 insertion(+) (limited to 'docs/api') diff --git a/docs/api/registry.rst b/docs/api/registry.rst index 25192f3ed..e18d1b6c2 100644 --- a/docs/api/registry.rst +++ b/docs/api/registry.rst @@ -44,3 +44,4 @@ introspection altogether (pass as ``introspector`` to the :term:`Configurator` constructor). + This class is new as of :app:`Pyramid` 1.3. -- cgit v1.2.3 From 56df902d0a5bcd29a2b4c3dfafab9a09d6f0c29d Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 8 Dec 2011 04:26:15 -0500 Subject: - New APIs: ``pyramid.path.AssetResolver`` and ``pyramid.path.DottedNameResolver``. The former can be used to resolve asset specifications, the latter can be used to resolve dotted names to modules or packages. --- docs/api/path.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 docs/api/path.rst (limited to 'docs/api') diff --git a/docs/api/path.rst b/docs/api/path.rst new file mode 100644 index 000000000..045d77da2 --- /dev/null +++ b/docs/api/path.rst @@ -0,0 +1,13 @@ +.. _path_module: + +:mod:`pyramid.path` +--------------------------- + +.. automodule:: pyramid.path + + .. autoclass:: DottedNameResolver + :members: + + .. autoclass:: AssetResolver + :members: + -- cgit v1.2.3 From 078859d058ac8c1617349a12ea29b9d1d0187485 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 8 Dec 2011 17:10:18 -0500 Subject: provide caller_path support for both asset resolver and dotted name resolver, make it the default --- docs/api/path.rst | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'docs/api') diff --git a/docs/api/path.rst b/docs/api/path.rst index 045d77da2..d46c35d8e 100644 --- a/docs/api/path.rst +++ b/docs/api/path.rst @@ -5,6 +5,13 @@ .. automodule:: pyramid.path + .. attribute:: CALLER_PACKAGE + + A constant used by the constructor of + :class:`pyramid.path.DottedNameResolver` and + :class:`pyramid.path.AssetResolver` (see their docstrings for more + info). + .. autoclass:: DottedNameResolver :members: -- cgit v1.2.3 From 4375cf2bad3535ce896e95fcf1e388e33f2e8ecf Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 14 Dec 2011 03:41:03 -0500 Subject: Flesh out new view_defaults feature and add docs, change notes, and add to whatsnew. --- docs/api/view.rst | 3 +++ 1 file changed, 3 insertions(+) (limited to 'docs/api') diff --git a/docs/api/view.rst b/docs/api/view.rst index 4dddea25f..9f59ddae7 100644 --- a/docs/api/view.rst +++ b/docs/api/view.rst @@ -16,6 +16,9 @@ .. autoclass:: view_config :members: + .. autoclass:: view_defaults + :members: + .. autoclass:: static :members: :inherited-members: -- cgit v1.2.3 From bfd4b39b3467681ad34b1dda74acd20294e81a86 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 14 Dec 2011 09:10:10 -0500 Subject: - Changed scaffolding machinery around a bit to make it easier for people who want to have extension scaffolds that can work across Pyramid 1.0.X, 1.1.X, 1.2.X and 1.3.X. See the new "Creating Pyramid Scaffolds" chapter in the narrative documentation for more info. - Added an API docs chapter for ``pyramid.scaffolds``. - Added a narrative docs chapter named "Creating Pyramid Scaffolds". - The ``template_renderer`` method of ``pyramid.scaffolds.PyramidScaffold`` was renamed to ``render_template``. If you were overriding it, you're a bad person, because it wasn't an API before now. But we're nice so we're letting you know. --- docs/api/scaffolds.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 docs/api/scaffolds.rst (limited to 'docs/api') diff --git a/docs/api/scaffolds.rst b/docs/api/scaffolds.rst new file mode 100644 index 000000000..827962e19 --- /dev/null +++ b/docs/api/scaffolds.rst @@ -0,0 +1,13 @@ +.. _scaffolds_module: + +:mod:`pyramid.scaffolds` +------------------------ + +.. automodule:: pyramid.scaffolds + + .. autoclass:: pyramid.scaffolds.Template + :members: + + .. autoclass:: pyramid.scaffolds.PyramidTemplate + :members: + -- cgit v1.2.3 From 79a11ce169305ed32c4f3fa887450320ed837e94 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Fri, 30 Dec 2011 02:07:25 -0600 Subject: Documented Request.set_property. --- docs/api/request.rst | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 642e6c84f..9596e5621 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -8,6 +8,10 @@ .. autoclass:: Request :members: :inherited-members: + :exclude-members: add_response_callback, add_finished_callback, + route_url, route_path, current_route_url, + current_route_path, static_url, static_path, + model_url, resource_url, set_property .. attribute:: context @@ -204,6 +208,57 @@ body associated with this request, this property will raise an exception. See also :ref:`request_json_body`. + .. method:: set_property(func, name=None, reify=False) + + .. versionadded:: 1.3 + + Add a callable or a property descriptor to the request instance. + + Properties, unlike attributes, are lazily evaluated by executing + an underlying callable when accessed. They can be useful for + adding features to an object without any cost if those features + go unused. + + A property may also be reified via the + :class:`pyramid.decorator.reify` decorator by setting + ``reify=True``, allowing the result of the evaluation to be + cached. Thus the value of the property is only computed once for + the lifetime of the object. + + ``func`` can either be a callable that accepts the request as + its single positional parameter, or it can be a property + descriptor. + + If the ``func`` is a property descriptor a ``ValueError`` will + be raised if ``name`` is ``None`` or ``reify`` is ``True``. + + If ``name`` is None, the name of the property will be computed + from the name of the ``func``. + + .. code-block:: python + :linenos: + + def _connect(request): + conn = request.registry.dbsession() + def cleanup(_): + conn.close() + request.add_finished_callback(cleanup) + return conn + + @subscriber(NewRequest) + def new_request(event): + request = event.request + request.set_property(_connect, 'db', reify=True) + + The subscriber doesn't actually connect to the database, it just + provides the API which, when accessed via ``request.db``, will + create the connection. Thanks to reify, only one connection is + made per-request even if ``request.db`` is accessed many times. + + This pattern provides a way to augment the ``request`` object + without having to subclass it, which can be useful for extension + authors. + .. note:: For information about the API of a :term:`multidict` structure (such as -- cgit v1.2.3 From 442dc88ad5c03cf6b373e0d97a55f23dfa5563e3 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Sun, 8 Jan 2012 14:23:23 -0600 Subject: garden --- docs/api/renderers.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/renderers.rst b/docs/api/renderers.rst index 15670c46e..312aa0b31 100644 --- a/docs/api/renderers.rst +++ b/docs/api/renderers.rst @@ -20,5 +20,5 @@ as a view renderer argument, Pyramid avoids converting the view callable result into a Response object. This is useful if you want to reuse the view configuration and lookup machinery outside the context of its use by - the Pyramid router (e.g. the package named ``pyramid_rpc`` does this). + the Pyramid router. -- cgit v1.2.3 From 1b113f772b48862c99e8269ca59365bc2acff85c Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Wed, 11 Jan 2012 02:04:22 -0600 Subject: Renamed the func to callable in the docs. --- docs/api/request.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 9596e5621..1ab84e230 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -208,9 +208,7 @@ body associated with this request, this property will raise an exception. See also :ref:`request_json_body`. - .. method:: set_property(func, name=None, reify=False) - - .. versionadded:: 1.3 + .. method:: set_property(callable, name=None, reify=False) Add a callable or a property descriptor to the request instance. @@ -225,15 +223,15 @@ cached. Thus the value of the property is only computed once for the lifetime of the object. - ``func`` can either be a callable that accepts the request as + ``callable`` can either be a callable that accepts the request as its single positional parameter, or it can be a property descriptor. - If the ``func`` is a property descriptor a ``ValueError`` will - be raised if ``name`` is ``None`` or ``reify`` is ``True``. + If the ``callable`` is a property descriptor a ``ValueError`` + will be raised if ``name`` is ``None`` or ``reify`` is ``True``. If ``name`` is None, the name of the property will be computed - from the name of the ``func``. + from the name of the ``callable``. .. code-block:: python :linenos: @@ -259,6 +257,8 @@ without having to subclass it, which can be useful for extension authors. + .. versionadded:: 1.3 + .. note:: For information about the API of a :term:`multidict` structure (such as -- cgit v1.2.3 From 10320e24cc49644234b2a76a5d393916fd8ce7b3 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Sat, 21 Jan 2012 01:32:06 -0600 Subject: Added set_request_property to the docs. --- docs/api/config.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index dbfbb1761..d16930cc0 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -72,6 +72,8 @@ .. automethod:: set_request_factory + .. automethod:: set_request_property + .. automethod:: set_root_factory .. automethod:: set_view_mapper -- cgit v1.2.3 From f4952ee0d30eeb67976684d6422f5db05d9f5264 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 7 Feb 2012 20:18:39 -0500 Subject: add asset descriptor interface --- docs/api/interfaces.rst | 3 +++ 1 file changed, 3 insertions(+) (limited to 'docs/api') diff --git a/docs/api/interfaces.rst b/docs/api/interfaces.rst index 5b190b53b..11cd8cf7e 100644 --- a/docs/api/interfaces.rst +++ b/docs/api/interfaces.rst @@ -76,3 +76,6 @@ Other Interfaces .. autointerface:: IActionInfo :members: + + .. autointerface:: IAssetDescriptor + :members: -- cgit v1.2.3 From 748aad47f90136b151be13f477ed6af1caed0493 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 15 Feb 2012 19:09:08 -0500 Subject: - Add ``pyramid.config.Configurator.set_traverser`` API method. See the Hooks narrative documentation section entitled "Changing the Traverser" for more information. This is not a new feature, it just provides an API for adding a traverser without needing to use the ZCA API. --- docs/api/config.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index d16930cc0..3c5ee563a 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -94,6 +94,8 @@ .. automethod:: set_notfound_view + .. automethod:: set_traverser + .. automethod:: set_renderer_globals_factory(factory) .. attribute:: introspectable -- cgit v1.2.3 From c51896756eeffc7e8c50ad71300ec355ae47465a Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 17 Feb 2012 01:08:42 -0500 Subject: Features -------- - Add ``pyramid.config.Configurator.add_resource_url_adapter`` API method. See the Hooks narrative documentation section entitled "Changing How pyramid.request.Request.resource_url Generates a URL" for more information. This is not a new feature, it just provides an API for adding a resource url adapter without needing to use the ZCA API. - A new interface was added: ``pyramid.interfaces.IResourceURL``. An adapter implementing its interface can be used to override resource URL generation when ``request.resource_url`` is called. This interface replaces the now-deprecated ``pyramid.interfaces.IContextURL`` interface. - The dictionary passed to a resource's ``__resource_url__`` method (see "Overriding Resource URL Generation" in the "Resources" chapter) now contains an ``app_url`` key, representing the application URL generated during ``request.resource_url``. It represents a potentially customized URL prefix, containing potentially custom scheme, host and port information passed by the user to ``request.resource_url``. It should be used instead of ``request.application_url`` where necessary. - The ``request.resource_url`` API now accepts these arguments: ``app_url``, ``scheme``, ``host``, and ``port``. The app_url argument can be used to replace the URL prefix wholesale during url generation. The ``scheme``, ``host``, and ``port`` arguments can be used to replace the respective default values of ``request.application_url`` partially. - A new API named ``request.resource_path`` now exists. It works like ``request.resource_url`` but produces a relative URL rather than an absolute one. - The ``request.route_url`` API now accepts these arguments: ``_app_url``, ``_scheme``, ``_host``, and ``_port``. The ``_app_url`` argument can be used to replace the URL prefix wholesale during url generation. The ``_scheme``, ``_host``, and ``_port`` arguments can be used to replace the respective default values of ``request.application_url`` partially. Backwards Incompatibilities --------------------------- - The ``pyramid.interfaces.IContextURL`` interface has been deprecated. People have been instructed to use this to register a resource url adapter in the "Hooks" chapter to use to influence ``request.resource_url`` URL generation for resources found via custom traversers since Pyramid 1.0. The interface still exists and registering such an adapter still works, but this interface will be removed from the software after a few major Pyramid releases. You should replace it with an equivalent ``pyramid.interfaces.IResourceURL`` adapter, registered using the new ``pyramid.config.Configurator.add_resource_url_adapter`` API. A deprecation warning is now emitted when a ``pyramid.interfaces.IContextURL`` adapter is found when ``request.resource_url`` is called. Misc ---- - Change ``set_traverser`` API name to ``add_traverser``. Ref #438. --- docs/api/config.rst | 2 +- docs/api/interfaces.rst | 4 ++++ docs/api/request.rst | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index 3c5ee563a..3fc2cfc44 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -94,7 +94,7 @@ .. automethod:: set_notfound_view - .. automethod:: set_traverser + .. automethod:: add_traverser .. automethod:: set_renderer_globals_factory(factory) diff --git a/docs/api/interfaces.rst b/docs/api/interfaces.rst index 11cd8cf7e..1dea5fab0 100644 --- a/docs/api/interfaces.rst +++ b/docs/api/interfaces.rst @@ -79,3 +79,7 @@ Other Interfaces .. autointerface:: IAssetDescriptor :members: + + .. autointerface:: IResourceURL + :members: + diff --git a/docs/api/request.rst b/docs/api/request.rst index 1ab84e230..e1b233fbc 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -183,6 +183,8 @@ .. automethod:: resource_url + .. automethod:: resource_path + .. attribute:: response_* In Pyramid 1.0, you could set attributes on a -- cgit v1.2.3 From 3885448eea74d4c79bf34dae0fb3a7fc767cb85c Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 17 Feb 2012 20:58:12 -0500 Subject: docs rearranging / fixing --- docs/api/config.rst | 88 ++++++++++++++++++++++++++++------------------------- 1 file changed, 47 insertions(+), 41 deletions(-) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index 3fc2cfc44..87ba94673 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -7,56 +7,27 @@ .. autoclass:: Configurator - .. attribute:: registry - - The :term:`application registry` which holds the configuration - associated with this configurator. - - .. automethod:: begin - - .. automethod:: end - - .. automethod:: hook_zca - - .. automethod:: unhook_zca - - .. automethod:: get_settings - - .. automethod:: commit - - .. automethod:: action - - .. automethod:: include - - .. automethod:: add_directive - - .. automethod:: with_package - - .. automethod:: maybe_dotted + .. automethod:: add_route - .. automethod:: absolute_asset_spec + .. automethod:: add_view - .. automethod:: setup_registry + .. automethod:: add_static_view(name, path, cache_max_age=3600, permission=NO_PERMISSION_REQUIRED) .. automethod:: add_renderer - .. automethod:: add_response_adapter - - .. automethod:: add_route + .. automethod:: add_subscriber - .. automethod:: add_static_view(name, path, cache_max_age=3600, permission=NO_PERMISSION_REQUIRED) + .. automethod:: add_response_adapter .. automethod:: add_settings - .. automethod:: add_subscriber - .. automethod:: add_translation_dirs - .. automethod:: add_view - .. automethod:: add_tween - .. automethod:: derive_view + .. automethod:: add_traverser + + .. automethod:: add_resource_url_adapter .. automethod:: make_wsgi_app() @@ -94,17 +65,45 @@ .. automethod:: set_notfound_view - .. automethod:: add_traverser - .. automethod:: set_renderer_globals_factory(factory) + .. automethod:: begin + + .. automethod:: end + + .. automethod:: hook_zca + + .. automethod:: unhook_zca + + .. automethod:: get_settings + + .. automethod:: commit + + .. automethod:: action + + .. automethod:: include + + .. automethod:: add_directive + + .. automethod:: with_package + + .. automethod:: maybe_dotted + + .. automethod:: absolute_asset_spec + + .. automethod:: setup_registry + + .. automethod:: derive_view + .. attribute:: introspectable A shortcut attribute which points to the :class:`pyramid.registry.Introspectable` class (used during directives to provide introspection to actions). - This attribute is new as of :app:`Pyramid` 1.3. + .. note:: + + This attribute is new as of :app:`Pyramid` 1.3. .. attribute:: introspector @@ -114,7 +113,14 @@ ``introspector`` argument, this attribute will be that value. Otherwise, it will be an instance of a default introspector type. - This attribute is new as of :app:`Pyramid` 1.3. + .. note:: + + This attribute is new as of :app:`Pyramid` 1.3. + + .. attribute:: registry + + The :term:`application registry` which holds the configuration + associated with this configurator. .. attribute:: global_registries -- cgit v1.2.3 From 66b20a9d467582064b91295dfd364118cc68a568 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 18 Feb 2012 10:12:17 -0500 Subject: categorized configurator methods --- docs/api/config.rst | 133 +++++++++++++++++++++++++++------------------------- 1 file changed, 68 insertions(+), 65 deletions(-) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index 87ba94673..b76fed9cb 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -1,99 +1,102 @@ .. _configuration_module: +.. role:: methodcategory + :class: methodcategory + :mod:`pyramid.config` --------------------- .. automodule:: pyramid.config - .. autoclass:: Configurator - - .. automethod:: add_route - - .. automethod:: add_view - - .. automethod:: add_static_view(name, path, cache_max_age=3600, permission=NO_PERMISSION_REQUIRED) - - .. automethod:: add_renderer - - .. automethod:: add_subscriber - - .. automethod:: add_response_adapter - - .. automethod:: add_settings +.. autoclass:: Configurator - .. automethod:: add_translation_dirs + :methodcategory:`Controlling Configuration State` - .. automethod:: add_tween + .. automethod:: commit + .. automethod:: begin + .. automethod:: end + .. automethod:: include + .. automethod:: make_wsgi_app() + .. automethod:: scan - .. automethod:: add_traverser + :methodcategory:`Adding Routes and Views` - .. automethod:: add_resource_url_adapter - - .. automethod:: make_wsgi_app() + .. automethod:: add_route + .. automethod:: add_static_view(name, path, cache_max_age=3600, permission=NO_PERMISSION_REQUIRED) + .. automethod:: add_view + .. automethod:: set_forbidden_view + .. automethod:: set_notfound_view - .. automethod:: override_asset(to_override, override_with) + :methodcategory:`Adding an Event Subscriber` - .. automethod:: scan + .. automethod:: add_subscriber - .. automethod:: set_locale_negotiator + :methodcategory:`Using Security` + .. automethod:: set_authentication_policy + .. automethod:: set_authorization_policy .. automethod:: set_default_permission - .. automethod:: set_session_factory - - .. automethod:: set_request_factory + :methodcategory:`Setting Request Properties` .. automethod:: set_request_property - .. automethod:: set_root_factory - - .. automethod:: set_view_mapper - - .. automethod:: set_authentication_policy - - .. automethod:: set_authorization_policy - - .. automethod:: testing_securitypolicy + :methodcategory:`Using I18N` - .. automethod:: testing_resources - - .. automethod:: testing_add_subscriber + .. automethod:: add_translation_dirs + .. automethod:: set_locale_negotiator - .. automethod:: testing_add_renderer + :methodcategory:`Overriding Assets` - .. automethod:: set_forbidden_view + .. automethod:: override_asset(to_override, override_with) - .. automethod:: set_notfound_view + :methodcategory:`Setting Renderer Globals` .. automethod:: set_renderer_globals_factory(factory) - .. automethod:: begin - - .. automethod:: end - - .. automethod:: hook_zca - - .. automethod:: unhook_zca + :methodcategory:`Getting and Adding Settings` + .. automethod:: add_settings .. automethod:: get_settings - .. automethod:: commit + :methodcategory:`Hooking Pyramid Behavior` - .. automethod:: action + .. automethod:: add_renderer + .. automethod:: add_resource_url_adapter + .. automethod:: add_response_adapter + .. automethod:: add_traverser + .. automethod:: add_tween + .. automethod:: set_request_factory + .. automethod:: set_root_factory + .. automethod:: set_session_factory + .. automethod:: set_view_mapper - .. automethod:: include + :methodcategory:`Extension Author APIs` + .. automethod:: action .. automethod:: add_directive - .. automethod:: with_package - .. automethod:: maybe_dotted + :methodcategory:`Utility Methods` .. automethod:: absolute_asset_spec - + .. automethod:: derive_view + .. automethod:: maybe_dotted .. automethod:: setup_registry - .. automethod:: derive_view + :methodcategory:`ZCA-Related APIs` + + .. automethod:: hook_zca + .. automethod:: unhook_zca + + :methodcategory:`Testing Helper APIs` + + .. automethod:: testing_add_renderer + .. automethod:: testing_add_subscriber + .. automethod:: testing_resources + .. automethod:: testing_securitypolicy + + :methodcategory:`Attributes` .. attribute:: introspectable @@ -122,15 +125,15 @@ The :term:`application registry` which holds the configuration associated with this configurator. - .. attribute:: global_registries +.. attribute:: global_registries - The set of registries that have been created for :app:`Pyramid` - applications, one per each call to - :meth:`pyramid.config.Configurator.make_wsgi_app` in the current - process. The object itself supports iteration and has a ``last`` - property containing the last registry loaded. + The set of registries that have been created for :app:`Pyramid` + applications, one per each call to + :meth:`pyramid.config.Configurator.make_wsgi_app` in the current + process. The object itself supports iteration and has a ``last`` property + containing the last registry loaded. - The registries contained in this object are stored as weakrefs, - thus they will only exist for the lifetime of the actual - applications for which they are being used. + The registries contained in this object are stored as weakrefs, thus they + will only exist for the lifetime of the actual applications for which they + are being used. -- cgit v1.2.3 From 844ed90133f051d013330cb0ed4c95dbb29eecc1 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 20 Feb 2012 12:41:47 -0500 Subject: Features -------- - Add an ``introspection`` boolean to the Configurator constructor. If this is ``True``, actions registered using the Configurator will be registered with the introspector. If it is ``False``, they won't. The default is ``True``. Setting it to ``False`` during action processing will prevent introspection for any following registration statements, and setting it to ``True`` will start them up again. This addition is to service a requirement that the debug toolbar's own views and methods not show up in the introspector. Backwards Incompatibilities --------------------------- - Remove ``pyramid.config.Configurator.with_context`` class method. It was never an API, it is only used by ``pyramid_zcml`` and its functionality has been moved to that package's latest release. This means that you'll need to use the latest release of ``pyramid_zcml`` with this release of Pyramid. - The ``introspector`` argument to the ``pyramid.config.Configurator`` constructor API has been removed. It has been replaced by the boolean ``introspection`` flag. - The ``pyramid.registry.noop_introspector`` API object has been removed. --- docs/api/registry.rst | 7 ------- 1 file changed, 7 deletions(-) (limited to 'docs/api') diff --git a/docs/api/registry.rst b/docs/api/registry.rst index e18d1b6c2..e62e2ba6f 100644 --- a/docs/api/registry.rst +++ b/docs/api/registry.rst @@ -38,10 +38,3 @@ This class is new as of :app:`Pyramid` 1.3. -.. class:: noop_introspector - - An introspector which throws away all registrations, useful for disabling - introspection altogether (pass as ``introspector`` to the - :term:`Configurator` constructor). - - This class is new as of :app:`Pyramid` 1.3. -- cgit v1.2.3 From 65d4a671283f9162afd4c0f8a61009d1ac0b904f Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 20 Feb 2012 13:49:10 -0500 Subject: remove untruth --- docs/api/config.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index b76fed9cb..ca9351db0 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -112,9 +112,7 @@ The :term:`introspector` related to this configuration. It is an instance implementing the :class:`pyramid.interfaces.IIntrospector` - interface. If the Configurator constructor was supplied with an - ``introspector`` argument, this attribute will be that value. - Otherwise, it will be an instance of a default introspector type. + interface. .. note:: -- cgit v1.2.3 From 225a7b88ced6d2c4453a67b03d3c3592caf5141a Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 20 Feb 2012 13:53:22 -0500 Subject: recategorize a couple of methods --- docs/api/config.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index ca9351db0..6b4ed7b1b 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -76,18 +76,18 @@ .. automethod:: action .. automethod:: add_directive .. automethod:: with_package + .. automethod:: derive_view :methodcategory:`Utility Methods` .. automethod:: absolute_asset_spec - .. automethod:: derive_view .. automethod:: maybe_dotted - .. automethod:: setup_registry :methodcategory:`ZCA-Related APIs` .. automethod:: hook_zca .. automethod:: unhook_zca + .. automethod:: setup_registry :methodcategory:`Testing Helper APIs` -- cgit v1.2.3 From 0db4a157083d51251b4d3f574a1699fc76359c9d Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 22 Feb 2012 15:37:50 -0500 Subject: - New API: ``pyramid.config.Configurator.add_notfound_view``. This is a wrapper for ``pyramid.Config.configurator.add_view`` which provides easy append_slash support. It should be preferred over calling ``add_view`` directly with ``context=HTTPNotFound`` as was previously recommended. - New API: ``pyramid.view.notfound_view_config``. This is a decorator constructor like ``pyramid.view.view_config`` that calls ``pyramid.config.Configurator.add_notfound_view`` when scanned. It should be preferred over using ``pyramid.view.view_config`` with ``context=HTTPNotFound`` as was previously recommended. - The older deprecated ``set_notfound_view`` Configurator method is now an alias for the new ``add_notfound_view`` Configurator method. This has the following impact: the ``context`` sent to views with a ``(context, request)`` call signature registered via the deprecated ``add_notfound_view``/``set_notfound_view`` will now be the HTTPNotFound exception object instead of the actual resource context found. Use ``request.context`` to get the actual resource context. It's also recommended to disuse ``set_notfound_view`` in favor of ``add_notfound_view``, despite the aliasing. - The API documentation for ``pyramid.view.append_slash_notfound_view`` and ``pyramid.view.AppendSlashNotFoundViewFactory`` was removed. These names still exist and are still importable, but they are no longer APIs. Use ``pyramid.config.Configurator.add_notfound_view(append_slash=True)`` or ``pyramid.view.notfound_view_config(append_slash=True)`` to get the same behavior. - The ``set_forbidden_view`` method of the Configurator was removed from the documentation. It has been deprecated since Pyramid 1.1. - The AppendSlashNotFoundViewFactory used request.path to match routes. This was wrong because request.path contains the script name, and this would cause it to fail in circumstances where the script name was not empty. It should have used request.path_info, and now does. - Updated the "Registering a Not Found View" section of the "Hooks" chapter, replacing explanations of registering a view using ``add_view`` or ``view_config`` with ones using ``add_notfound_view`` or ``notfound_view_config``. - Updated the "Redirecting to Slash-Appended Routes" section of the "URL Dispatch" chapter, replacing explanations of registering a view using ``add_view`` or ``view_config`` with ones using ``add_notfound_view`` or ``notfound_view_config`` --- docs/api/config.rst | 3 +-- docs/api/view.rst | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index 6b4ed7b1b..bf5fdbb7c 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -24,8 +24,7 @@ .. automethod:: add_route .. automethod:: add_static_view(name, path, cache_max_age=3600, permission=NO_PERMISSION_REQUIRED) .. automethod:: add_view - .. automethod:: set_forbidden_view - .. automethod:: set_notfound_view + .. automethod:: add_notfound_view :methodcategory:`Adding an Event Subscriber` diff --git a/docs/api/view.rst b/docs/api/view.rst index 9f59ddae7..cb269e48e 100644 --- a/docs/api/view.rst +++ b/docs/api/view.rst @@ -19,11 +19,11 @@ .. autoclass:: view_defaults :members: + .. autoclass:: notfound_view_config + :members: + .. autoclass:: static :members: :inherited-members: - .. autofunction:: append_slash_notfound_view(context, request) - - .. autoclass:: AppendSlashNotFoundViewFactory -- cgit v1.2.3 From a7fe30f0eabd6c6fd3bcc910faa41720a75056de Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 22 Feb 2012 19:24:09 -0500 Subject: - New API: ``pyramid.config.Configurator.add_forbidden_view``. This is a wrapper for ``pyramid.Config.configurator.add_view`` which does the right thing about permissions. It should be preferred over calling ``add_view`` directly with ``context=HTTPForbidden`` as was previously recommended. - New API: ``pyramid.view.forbidden_view_config``. This is a decorator constructor like ``pyramid.view.view_config`` that calls ``pyramid.config.Configurator.add_forbidden_view`` when scanned. It should be preferred over using ``pyramid.view.view_config`` with ``context=HTTPForbidden`` as was previously recommended. - Updated the "Creating a Not Forbidden View" section of the "Hooks" chapter, replacing explanations of registering a view using ``add_view`` or ``view_config`` with ones using ``add_forbidden_view`` or ``forbidden_view_config``. - Updated all tutorials to use ``pyramid.view.forbidden_view_config`` rather than ``pyramid.view.view_config`` with an HTTPForbidden context. --- docs/api/config.rst | 1 + docs/api/view.rst | 3 +++ 2 files changed, 4 insertions(+) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index bf5fdbb7c..cd58e74d3 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -25,6 +25,7 @@ .. automethod:: add_static_view(name, path, cache_max_age=3600, permission=NO_PERMISSION_REQUIRED) .. automethod:: add_view .. automethod:: add_notfound_view + .. automethod:: add_forbidden_view :methodcategory:`Adding an Event Subscriber` diff --git a/docs/api/view.rst b/docs/api/view.rst index cb269e48e..21d2bb90d 100644 --- a/docs/api/view.rst +++ b/docs/api/view.rst @@ -22,6 +22,9 @@ .. autoclass:: notfound_view_config :members: + .. autoclass:: forbidden_view_config + :members: + .. autoclass:: static :members: :inherited-members: -- cgit v1.2.3 From 6b3cca0d548c0c3bcec62902f5b261df4e7c1d1e Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 22 Feb 2012 20:02:03 -0500 Subject: - New APIs: ``pyramid.response.FileResponse`` and ``pyramid.response.FileIter``, for usage in views that must serve files "manually". --- docs/api/response.rst | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docs/api') diff --git a/docs/api/response.rst b/docs/api/response.rst index 8020b629a..52978a126 100644 --- a/docs/api/response.rst +++ b/docs/api/response.rst @@ -9,6 +9,11 @@ :members: :inherited-members: +.. autoclass:: FileResponse + :members: + +.. autoclass:: FileIter + Functions ~~~~~~~~~ -- cgit v1.2.3 From 283494c2338dbd6e89a7da79a05318992ee04cfc Mon Sep 17 00:00:00 2001 From: Paul Winkler Date: Fri, 24 Feb 2012 14:24:50 -0500 Subject: More trivial typos --- docs/api/security.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/api') diff --git a/docs/api/security.rst b/docs/api/security.rst index 7086690e9..814b68e5a 100644 --- a/docs/api/security.rst +++ b/docs/api/security.rst @@ -72,13 +72,13 @@ Return Values The ACE "action" (the first element in an ACE e.g. ``(Allow, Everyone, 'read')`` that means allow access. A sequence of ACEs makes up an - ACL. It is a string, and it's actual value is "Allow". + ACL. It is a string, and its actual value is "Allow". .. attribute:: Deny The ACE "action" (the first element in an ACE e.g. ``(Deny, 'george', 'read')`` that means deny access. A sequence of ACEs - makes up an ACL. It is a string, and it's actual value is "Deny". + makes up an ACL. It is a string, and its actual value is "Deny". .. autoclass:: ACLDenied :members: -- cgit v1.2.3 From 01eac92dcdbe0d51b75783350997e69a7613da9e Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 24 Feb 2012 15:15:18 -0500 Subject: docs-deprecate tmpl_context --- docs/api/request.rst | 4 ---- 1 file changed, 4 deletions(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index e1b233fbc..1112ea069 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -145,10 +145,6 @@ ``request.session`` attribute will cause a :class:`pyramid.exceptions.ConfigurationError` to be raised. - .. attribute:: tmpl_context - - The template context for Pylons-style applications. - .. attribute:: matchdict If a :term:`route` has matched during this request, this attribute will -- cgit v1.2.3 From d81ea33ac67ac750053acbfd12616db0130de3c8 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Tue, 10 Jan 2012 22:52:24 -0600 Subject: intermediate commit --- docs/api/renderers.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/api') diff --git a/docs/api/renderers.rst b/docs/api/renderers.rst index 312aa0b31..ea000ad02 100644 --- a/docs/api/renderers.rst +++ b/docs/api/renderers.rst @@ -11,6 +11,8 @@ .. autofunction:: render_to_response +.. autoclass:: JSON + .. autoclass:: JSONP .. attribute:: null_renderer -- cgit v1.2.3 From ba60524b56a639ecad42f85b63af2120d9d96cdc Mon Sep 17 00:00:00 2001 From: Wayne Witzel III Date: Wed, 28 Mar 2012 12:03:52 -0400 Subject: JSON-API rework and Object.__json__ support --- docs/api/renderers.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/api') diff --git a/docs/api/renderers.rst b/docs/api/renderers.rst index ea000ad02..ab182365e 100644 --- a/docs/api/renderers.rst +++ b/docs/api/renderers.rst @@ -15,6 +15,8 @@ .. autoclass:: JSONP +.. autoclass:: ObjectJSONEncoder + .. attribute:: null_renderer An object that can be used in advanced integration cases as input to the -- cgit v1.2.3 From 1f0d9d2193bb9557d4475885776b5679c8dbfa23 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Mon, 16 Apr 2012 23:19:14 -0500 Subject: docs for json defaults --- docs/api/renderers.rst | 2 -- 1 file changed, 2 deletions(-) (limited to 'docs/api') diff --git a/docs/api/renderers.rst b/docs/api/renderers.rst index ab182365e..ea000ad02 100644 --- a/docs/api/renderers.rst +++ b/docs/api/renderers.rst @@ -15,8 +15,6 @@ .. autoclass:: JSONP -.. autoclass:: ObjectJSONEncoder - .. attribute:: null_renderer An object that can be used in advanced integration cases as input to the -- cgit v1.2.3 From fbbb20c7953370c86f999e865b1a9d682690eb70 Mon Sep 17 00:00:00 2001 From: Brian Sutherland Date: Sat, 16 Jun 2012 12:57:46 +0200 Subject: A context manager for test setup --- docs/api/testing.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/api') diff --git a/docs/api/testing.rst b/docs/api/testing.rst index f388dc263..1366a1795 100644 --- a/docs/api/testing.rst +++ b/docs/api/testing.rst @@ -9,6 +9,8 @@ .. autofunction:: tearDown + .. autofunction:: testConfig(registry=None, request=None, hook_zca=True, autocommit=True, settings=None) + .. autofunction:: cleanUp .. autoclass:: DummyResource -- cgit v1.2.3 From 0196b2a06ef66d2e8b33a03cc84373ab84ba44be Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 6 Aug 2012 00:48:29 -0400 Subject: add docs for third-party view predicates --- docs/api/config.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index cd58e74d3..bc9e067b1 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -66,6 +66,8 @@ .. automethod:: add_response_adapter .. automethod:: add_traverser .. automethod:: add_tween + .. automethod:: add_route_predicate + .. automethod:: add_view_predicate .. automethod:: set_request_factory .. automethod:: set_root_factory .. automethod:: set_session_factory -- cgit v1.2.3 From d986123332806aadc43b1daab396ff5200ec10ce Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 6 Aug 2012 23:56:24 -0400 Subject: move stuff from config.util to registry so it can be a set of API (which are now documented), resolve deferred discriminators in introspectable.register so that a directive can depend on a deferred discriminator, put head-adding code in predicate instead of in add_view itself --- docs/api/registry.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'docs/api') diff --git a/docs/api/registry.rst b/docs/api/registry.rst index e62e2ba6f..1d5d52248 100644 --- a/docs/api/registry.rst +++ b/docs/api/registry.rst @@ -38,3 +38,17 @@ This class is new as of :app:`Pyramid` 1.3. +.. autoclass:: Deferred + + This class is new as of :app:`Pyramid` 1.4. + +.. autofunction:: undefer + + This function is new as of :app:`Pyramid` 1.4. + +.. autoclass:: predvalseq + + This class is new as of :app:`Pyramid` 1.4. + + + -- cgit v1.2.3 From 6b180cbb77d6c5bee0e75220d93fc1800d1217df Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 15 Aug 2012 22:49:59 -0400 Subject: - An ``add_permission`` directive method was added to the Configurator. This directive registers a free-standing permission introspectable into the Pyramid introspection system. Frameworks built atop Pyramid can thus use the the ``permissions`` introspectable category data to build a comprehensive list of permissions supported by a running system. Before this method was added, permissions were already registered in this introspectable category as a side effect of naming them in an ``add_view`` call, this method just makes it possible to arrange for a permission to be put into the ``permissions`` introspectable category without naming it along with an associated view. Here's an example of usage of ``add_permission``:: config = Configurator() config.add_permission('view') --- docs/api/config.rst | 1 + 1 file changed, 1 insertion(+) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index bc9e067b1..1b887988a 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -36,6 +36,7 @@ .. automethod:: set_authentication_policy .. automethod:: set_authorization_policy .. automethod:: set_default_permission + .. automethod:: add_permission :methodcategory:`Setting Request Properties` -- cgit v1.2.3 From 2c25342383eed7b10e349b2396eed08d332cfb80 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Thu, 16 Aug 2012 02:28:43 -0500 Subject: docs-deprecated set_request_property --- docs/api/config.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index 1b887988a..8dbe6de91 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -38,9 +38,9 @@ .. automethod:: set_default_permission .. automethod:: add_permission - :methodcategory:`Setting Request Properties` + :methodcategory:`Extending the Request Object` - .. automethod:: set_request_property + .. automethod:: set_request_method :methodcategory:`Using I18N` -- cgit v1.2.3 From 9cdb28614e558a886cb75d1d9ce9689621199722 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 16 Aug 2012 11:25:23 -0400 Subject: readd set_request_property to docs (just so when people run across it in in-the-wild code they're not totally confused); we'll remove it later --- docs/api/config.rst | 1 + 1 file changed, 1 insertion(+) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index 8dbe6de91..028a55d4b 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -41,6 +41,7 @@ :methodcategory:`Extending the Request Object` .. automethod:: set_request_method + .. automethod:: set_request_property :methodcategory:`Using I18N` -- cgit v1.2.3 From bbb2a6ee5bf4a947e2f52808e04ed8bdbb68aa76 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 9 Sep 2012 14:20:25 -0400 Subject: remove docs for chameleon_zpt and chameleon_text (gone) --- docs/api/chameleon_text.rst | 31 ------------------------------- docs/api/chameleon_zpt.rst | 28 ---------------------------- 2 files changed, 59 deletions(-) delete mode 100644 docs/api/chameleon_text.rst delete mode 100644 docs/api/chameleon_zpt.rst (limited to 'docs/api') diff --git a/docs/api/chameleon_text.rst b/docs/api/chameleon_text.rst deleted file mode 100644 index 494f5b464..000000000 --- a/docs/api/chameleon_text.rst +++ /dev/null @@ -1,31 +0,0 @@ -.. _chameleon_text_module: - -:mod:`pyramid.chameleon_text` ----------------------------------- - -.. automodule:: pyramid.chameleon_text - - .. autofunction:: get_template - - .. autofunction:: render_template - - .. autofunction:: render_template_to_response - -These APIs will will work against template files which contain simple -``${Genshi}`` - style replacement markers. - -The API of :mod:`pyramid.chameleon_text` is identical to that of -:mod:`pyramid.chameleon_zpt`; only its import location is -different. If you need to import an API functions from this module as -well as the :mod:`pyramid.chameleon_zpt` module within the same -view file, use the ``as`` feature of the Python import statement, -e.g.: - -.. code-block:: python - :linenos: - - from pyramid.chameleon_zpt import render_template as zpt_render - from pyramid.chameleon_text import render_template as text_render - - - diff --git a/docs/api/chameleon_zpt.rst b/docs/api/chameleon_zpt.rst deleted file mode 100644 index df9a36a56..000000000 --- a/docs/api/chameleon_zpt.rst +++ /dev/null @@ -1,28 +0,0 @@ -.. _chameleon_zpt_module: - -:mod:`pyramid.chameleon_zpt` -------------------------------- - -.. automodule:: pyramid.chameleon_zpt - - .. autofunction:: get_template - - .. autofunction:: render_template - - .. autofunction:: render_template_to_response - -These APIs will work against files which supply template text which -matches the :term:`ZPT` specification. - -The API of :mod:`pyramid.chameleon_zpt` is identical to that of -:mod:`pyramid.chameleon_text`; only its import location is -different. If you need to import an API functions from this module as -well as the :mod:`pyramid.chameleon_text` module within the same -view file, use the ``as`` feature of the Python import statement, -e.g.: - -.. code-block:: python - :linenos: - - from pyramid.chameleon_zpt import render_template as zpt_render - from pyramid.chameleon_text import render_template as text_render -- cgit v1.2.3 From ef2e51792e4f2b970d23186dd883ad4fbf7d0815 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 9 Sep 2012 14:32:00 -0400 Subject: - The ``pyramid.settings.get_settings()`` API was removed. It had been printing a deprecation warning since Pyramid 1.0. If your code depended on this API, use ``pyramid.threadlocal.get_current_registry().settings`` instead or use the ``settings`` attribute of the registry available from the request (``request.registry.settings``). --- docs/api/settings.rst | 2 -- 1 file changed, 2 deletions(-) (limited to 'docs/api') diff --git a/docs/api/settings.rst b/docs/api/settings.rst index 6b12c038c..cd802e138 100644 --- a/docs/api/settings.rst +++ b/docs/api/settings.rst @@ -5,8 +5,6 @@ .. automodule:: pyramid.settings - .. autofunction:: get_settings - .. autofunction:: asbool .. autofunction:: aslist -- cgit v1.2.3 From 023c88b67b907dd3682ef71216245609c9bbdbe1 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 9 Sep 2012 23:01:06 -0400 Subject: rename set_request_method to add_request_method. closes #683 --- docs/api/config.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index 028a55d4b..5d2bce23e 100644 --- a/docs/api/config.rst +++ b/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` -- cgit v1.2.3 From 07cb8f0e112642a6a40127232ddc06125a73750e Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 15 Sep 2012 18:58:45 -0400 Subject: add pyramid.decorator.reify as an API. Closes #682 --- docs/api/decorator.rst | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 docs/api/decorator.rst (limited to 'docs/api') diff --git a/docs/api/decorator.rst b/docs/api/decorator.rst new file mode 100644 index 000000000..35d9131df --- /dev/null +++ b/docs/api/decorator.rst @@ -0,0 +1,9 @@ +.. _decorator_module: + +:mod:`pyramid.decorator` +-------------------------- + +.. automodule:: pyramid.decorator + +.. autofunction:: reify + -- cgit v1.2.3 From 277b2af26871a4d84730b6d3e38fbaa2f4102823 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 16 Sep 2012 02:33:39 -0400 Subject: add docs --- docs/api/request.rst | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 1112ea069..5e52cfd50 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -161,6 +161,49 @@ request, the value of this attribute will be ``None``. See :ref:`matched_route`. + .. method:: subrequest(request, use_tweens=False) + + Obtain a response object from the Pyramid application based on + information in the ``request`` object provided. The ``request`` object + must be an object that implements the Pyramid request interface (such + as a :class:`pyramid.request.Request` instance). If ``use_tweens`` is + ``True``, the request will be sent to the :term:`tween` in the tween + stack closest to the request ingress. If ``use_tweens`` is ``False``, + the request will be sent to the main router handler, and no tweens will + be invoked. This isn't *actually* a method of the Request object; it's + a callable added when the Pyramid router is invoked, or when a + subrequest is invoked. This function also: + + - manages the threadlocal stack (so that + :func:`~pyramid.threadlocal.get_current_request` and + :func:`~pyramid.threadlocal.get_current_registry` work during a + request) + + - Adds a ``registry`` attribute (the current Pyramid registry) and a + ``subrequest`` attribute (a callable) to the request object it's + handed. + + - sets request extensions (such as those added via + :meth:`~pyramid.config.Configurator.add_request_method` or + :meth:`~pyramid.config.Configurator.set_request_property`) on the + request it's passed. + + - causes a :class:`~pyramid.event.NewRequest` event to be sent at the + beginning of request processing. + + - causes a :class:`~pyramid.event.ContextFound` event to be sent + when a context resource is found. + + - causes a :class:`~pyramid.event.NewResponse` event to be sent when + the Pyramid application returns a response. + + - Calls any :term:`response callback` functions defined within the + request's lifetime if a response is obtained from the Pyramid + application. + + - Calls any :term:`finished callback` functions defined within the + request's lifetime. + .. automethod:: add_response_callback .. automethod:: add_finished_callback -- cgit v1.2.3 From 37d2c224b804dfebe9ee217c7a536364eacdee15 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 16 Sep 2012 03:25:17 -0400 Subject: docs and test --- docs/api/request.rst | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 5e52cfd50..603807abe 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -163,6 +163,10 @@ .. method:: subrequest(request, use_tweens=False) + .. warning:: + + This API was added in Pyramid 1.4a1. + Obtain a response object from the Pyramid application based on information in the ``request`` object provided. The ``request`` object must be an object that implements the Pyramid request interface (such @@ -204,6 +208,8 @@ - Calls any :term:`finished callback` functions defined within the request's lifetime. + See also :ref:`subrequest_chapter`. + .. automethod:: add_response_callback .. automethod:: add_finished_callback -- cgit v1.2.3 From 64452edb014423054d1bbc0bb3ed8a3e47b6f611 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 16 Sep 2012 03:54:08 -0400 Subject: rename subrequest to invoke_subrequest --- docs/api/request.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 603807abe..1718d0743 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -161,7 +161,7 @@ request, the value of this attribute will be ``None``. See :ref:`matched_route`. - .. method:: subrequest(request, use_tweens=False) + .. method:: invoke_subrequest(request, use_tweens=False) .. warning:: @@ -184,7 +184,7 @@ request) - Adds a ``registry`` attribute (the current Pyramid registry) and a - ``subrequest`` attribute (a callable) to the request object it's + ``invoke_subrequest`` attribute (a callable) to the request object it's handed. - sets request extensions (such as those added via -- cgit v1.2.3 From 7259e7e9f3d8f8eb70bcf782f622f8613f99a51d Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 16 Sep 2012 13:04:14 -0400 Subject: make use_tweens=True the default, add some more tests --- docs/api/request.rst | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 1718d0743..8af81cdac 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -161,7 +161,7 @@ request, the value of this attribute will be ``None``. See :ref:`matched_route`. - .. method:: invoke_subrequest(request, use_tweens=False) + .. method:: invoke_subrequest(request, use_tweens=True) .. warning:: @@ -174,9 +174,9 @@ ``True``, the request will be sent to the :term:`tween` in the tween stack closest to the request ingress. If ``use_tweens`` is ``False``, the request will be sent to the main router handler, and no tweens will - be invoked. This isn't *actually* a method of the Request object; it's - a callable added when the Pyramid router is invoked, or when a - subrequest is invoked. This function also: + be invoked. + + This function also: - manages the threadlocal stack (so that :func:`~pyramid.threadlocal.get_current_request` and @@ -208,7 +208,11 @@ - Calls any :term:`finished callback` functions defined within the request's lifetime. - See also :ref:`subrequest_chapter`. + ``invoke_subrequest`` isn't *actually* a method of the Request object; + it's a callable added when the Pyramid router is invoked, or when a + subrequest is invoked. This means that it's not available for use on a + request provided by e.g. the ``pshell`` environment. For more + information, see :ref:`subrequest_chapter`. .. automethod:: add_response_callback -- cgit v1.2.3 From db2a03786ec76f2c6b7eaebb6f1b7c8b844d8c82 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 16 Sep 2012 22:32:26 -0400 Subject: make use_tweens=False the default --- docs/api/request.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 8af81cdac..3a1439874 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -161,7 +161,7 @@ request, the value of this attribute will be ``None``. See :ref:`matched_route`. - .. method:: invoke_subrequest(request, use_tweens=True) + .. method:: invoke_subrequest(request, use_tweens=False) .. warning:: @@ -198,6 +198,9 @@ - causes a :class:`~pyramid.event.ContextFound` event to be sent when a context resource is found. + - Ensures that the user implied by the request passed has the necessary + authorization to invoke view callable before calling it. + - causes a :class:`~pyramid.event.NewResponse` event to be sent when the Pyramid application returns a response. -- cgit v1.2.3 From 68c00de2f71f95571c1876d024c9ad5d4dfeec2c Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 19 Sep 2012 03:30:18 -0400 Subject: add check_csrf convenience function --- docs/api/session.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/api') diff --git a/docs/api/session.rst b/docs/api/session.rst index 44b4bd860..31bc196ad 100644 --- a/docs/api/session.rst +++ b/docs/api/session.rst @@ -11,4 +11,6 @@ .. autofunction:: signed_deserialize + .. autofunction:: check_csrf_token + -- cgit v1.2.3 From 801adfb060911b92f9787ec6517250436b1373be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Domen=20Ko=C5=BEar?= Date: Sun, 23 Sep 2012 18:01:46 +0200 Subject: Add SHA512AuthTktAuthenticationPolicy and deprecate AuthTktAuthenticationPolicy --- docs/api/authentication.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/api') diff --git a/docs/api/authentication.rst b/docs/api/authentication.rst index 5d4dbd9e3..ed96e9c98 100644 --- a/docs/api/authentication.rst +++ b/docs/api/authentication.rst @@ -8,6 +8,8 @@ Authentication Policies .. automodule:: pyramid.authentication + .. autoclass:: SHA512AuthTktAuthenticationPolicy + .. autoclass:: AuthTktAuthenticationPolicy .. autoclass:: RepozeWho1AuthenticationPolicy -- cgit v1.2.3 From bdf4519f1fe5e4db0991b0aa2be6d6708472a7f2 Mon Sep 17 00:00:00 2001 From: Chris Rossi Date: Sun, 14 Oct 2012 14:16:09 -0400 Subject: Add BasicAuthAuthenticationPolicy to Sphinx documentation. Move Repoze1AuthenticationPolicy lower in the list. --- docs/api/authentication.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'docs/api') diff --git a/docs/api/authentication.rst b/docs/api/authentication.rst index 5d4dbd9e3..587026a3b 100644 --- a/docs/api/authentication.rst +++ b/docs/api/authentication.rst @@ -10,12 +10,14 @@ Authentication Policies .. autoclass:: AuthTktAuthenticationPolicy - .. autoclass:: RepozeWho1AuthenticationPolicy - .. autoclass:: RemoteUserAuthenticationPolicy .. autoclass:: SessionAuthenticationPolicy + .. autoclass:: BasicAuthAuthenticationPolicy + + .. autoclass:: RepozeWho1AuthenticationPolicy + Helper Classes ~~~~~~~~~~~~~~ -- cgit v1.2.3 From 41b7db829af0700c0b02185067db5b2ffd3e43f1 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Tue, 30 Oct 2012 02:24:43 -0500 Subject: updated authentication policy api documentation --- docs/api/authentication.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'docs/api') diff --git a/docs/api/authentication.rst b/docs/api/authentication.rst index 587026a3b..19d08618b 100644 --- a/docs/api/authentication.rst +++ b/docs/api/authentication.rst @@ -9,14 +9,24 @@ Authentication Policies .. automodule:: pyramid.authentication .. autoclass:: AuthTktAuthenticationPolicy + :members: + :inherited-members: .. autoclass:: RemoteUserAuthenticationPolicy + :members: + :inherited-members: .. autoclass:: SessionAuthenticationPolicy + :members: + :inherited-members: .. autoclass:: BasicAuthAuthenticationPolicy + :members: + :inherited-members: .. autoclass:: RepozeWho1AuthenticationPolicy + :members: + :inherited-members: Helper Classes ~~~~~~~~~~~~~~ -- cgit v1.2.3 From 04875452db1da40bd8ed0841869d511b8d86527d Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 4 Nov 2012 01:51:42 -0500 Subject: fix docs, upgrade tutorials, add change note, deprecate using zope.deprecation instead of a warning, make hashalg arg a kwarg in certain cases in case someone (maybe me) is using nonapi function imports from authentication --- docs/api/authentication.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/api') diff --git a/docs/api/authentication.rst b/docs/api/authentication.rst index e6ee5658b..49ee405eb 100644 --- a/docs/api/authentication.rst +++ b/docs/api/authentication.rst @@ -9,6 +9,8 @@ Authentication Policies .. automodule:: pyramid.authentication .. autoclass:: SHA512AuthTktAuthenticationPolicy + :members: + :inherited-members: .. autoclass:: AuthTktAuthenticationPolicy :members: -- cgit v1.2.3 From 19b8207ff1e959669d296407ed112545364a495d Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Sun, 4 Nov 2012 11:19:41 -0600 Subject: merged SHA512AuthTktAuthenticationPolicy into AuthTktAuthenticationPolicy AuthTktAuthenticationPolicy now accepts a hashalg parameter and is no longer deprecated. Docs recommend overriding hashalg and using 'sha512'. --- docs/api/authentication.rst | 4 ---- 1 file changed, 4 deletions(-) (limited to 'docs/api') diff --git a/docs/api/authentication.rst b/docs/api/authentication.rst index 49ee405eb..19d08618b 100644 --- a/docs/api/authentication.rst +++ b/docs/api/authentication.rst @@ -8,10 +8,6 @@ Authentication Policies .. automodule:: pyramid.authentication - .. autoclass:: SHA512AuthTktAuthenticationPolicy - :members: - :inherited-members: - .. autoclass:: AuthTktAuthenticationPolicy :members: :inherited-members: -- cgit v1.2.3 From 8f4fcc47c9405f20cfed3a40931f12534b3b7193 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Tue, 20 Nov 2012 22:47:50 -0500 Subject: coverage --- docs/api/paster.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/paster.rst b/docs/api/paster.rst index 3f7a1c364..bde128e05 100644 --- a/docs/api/paster.rst +++ b/docs/api/paster.rst @@ -7,7 +7,7 @@ .. autofunction:: bootstrap - .. autofunction:: get_app(config_uri, name=None) + .. autofunction:: get_app(config_uri, name=None, options=None) .. autofunction:: get_appsettings(config_uri, name=None) -- cgit v1.2.3 From e0062294430dd1d30d31b9f8c0a2e6e9060bcb76 Mon Sep 17 00:00:00 2001 From: Paul Everitt Date: Tue, 1 Jan 2013 11:49:52 -0500 Subject: Small fix for RST misfire. --- docs/api/registry.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/api') diff --git a/docs/api/registry.rst b/docs/api/registry.rst index 1d5d52248..4c1af2678 100644 --- a/docs/api/registry.rst +++ b/docs/api/registry.rst @@ -14,12 +14,12 @@ accessed as ``request.registry.settings`` or ``config.registry.settings`` in a typical Pyramid application. - .. attribute:: introspector + .. attribute:: introspector When a registry is set up (or created) by a :term:`Configurator`, the registry will be decorated with an instance named ``introspector`` implementing the :class:`pyramid.interfaces.IIntrospector` interface. - See also :attr:`pyramid.config.Configurator.introspector``. + See also :attr:`pyramid.config.Configurator.introspector`. When a registry is created "by hand", however, this attribute will not exist until set up by a configurator. -- cgit v1.2.3 From 08c2217e7f831379016e1ddee0b5d51eeca53878 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Tue, 1 Jan 2013 23:56:02 +0200 Subject: eliminate repeated "the" words --- docs/api/request.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 3a1439874..e4034c635 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -251,7 +251,7 @@ Assigning to one is still supported but will cause a deprecation warning to be emitted, and eventually the feature will be removed. For new code, instead of assigning ``response_*`` attributes to the - request, use API of the the :attr:`pyramid.request.Request.response` + request, use API of the :attr:`pyramid.request.Request.response` object (exposed to view code as ``request.response``) to influence rendered response behavior. -- cgit v1.2.3 From 043ccddb909327106264d10ed5d413760a51770d Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Wed, 2 Jan 2013 02:22:52 +0200 Subject: eliminate other repeated words --- docs/api/registry.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/registry.rst b/docs/api/registry.rst index 4c1af2678..a7879d3d5 100644 --- a/docs/api/registry.rst +++ b/docs/api/registry.rst @@ -33,7 +33,7 @@ The default implementation of the interface :class:`pyramid.interfaces.IIntrospectable` used by framework exenders. - An instance of this class is is created when + An instance of this class is created when :attr:`pyramid.config.Configurator.introspectable` is called. This class is new as of :app:`Pyramid` 1.3. -- cgit v1.2.3 From de5d2a88ef64a3f59222be1bd369ce226bbc0171 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Mon, 7 Jan 2013 01:37:30 +0200 Subject: redundant statement: the links preceeding the statement target the info referred to --- docs/api/path.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'docs/api') diff --git a/docs/api/path.rst b/docs/api/path.rst index d46c35d8e..814fc47d5 100644 --- a/docs/api/path.rst +++ b/docs/api/path.rst @@ -9,8 +9,7 @@ A constant used by the constructor of :class:`pyramid.path.DottedNameResolver` and - :class:`pyramid.path.AssetResolver` (see their docstrings for more - info). + :class:`pyramid.path.AssetResolver`. .. autoclass:: DottedNameResolver :members: -- cgit v1.2.3 From fa1ac6744f1e2308190ba84dd60d573b4fa25fb3 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Tue, 15 Jan 2013 00:56:42 +0200 Subject: another grammar fix --- docs/api/config.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index 5d2bce23e..e6a67830e 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -130,7 +130,7 @@ .. attribute:: global_registries The set of registries that have been created for :app:`Pyramid` - applications, one per each call to + applications, one for each call to :meth:`pyramid.config.Configurator.make_wsgi_app` in the current process. The object itself supports iteration and has a ``last`` property containing the last registry loaded. -- cgit v1.2.3 From 0b23b34cf7f759d7f2895696b8ec07c3a4d1e80a Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Wed, 23 Jan 2013 01:43:48 +0200 Subject: pyramid.config: take advantage of some Sphinx directives * versionadded * versionchanged * deprecated --- docs/api/config.rst | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index e6a67830e..39d504348 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -108,9 +108,7 @@ :class:`pyramid.registry.Introspectable` class (used during directives to provide introspection to actions). - .. note:: - - This attribute is new as of :app:`Pyramid` 1.3. + .. versionadded:: 1.3 .. attribute:: introspector @@ -118,9 +116,7 @@ instance implementing the :class:`pyramid.interfaces.IIntrospector` interface. - .. note:: - - This attribute is new as of :app:`Pyramid` 1.3. + .. versionadded:: 1.3 .. attribute:: registry -- cgit v1.2.3 From 23c8985a661b9e2b11b76750893724dc747ffc1c Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Tue, 29 Jan 2013 01:23:02 +0200 Subject: replace 'note' with the more correct 'versionadded' directive --- docs/api/request.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index e4034c635..9f1f71b31 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -163,9 +163,7 @@ .. method:: invoke_subrequest(request, use_tweens=False) - .. warning:: - - This API was added in Pyramid 1.4a1. + .. versionadded:: 1.4a1 Obtain a response object from the Pyramid application based on information in the ``request`` object provided. The ``request`` object -- cgit v1.2.3 From 40dbf42a2df1783c3d803adf950380c21512bb91 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Wed, 30 Jan 2013 00:41:23 +0200 Subject: use the more appropriate directives --- docs/api/registry.rst | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'docs/api') diff --git a/docs/api/registry.rst b/docs/api/registry.rst index a7879d3d5..db348495c 100644 --- a/docs/api/registry.rst +++ b/docs/api/registry.rst @@ -16,6 +16,8 @@ .. attribute:: introspector + .. versionadded:: 1.3 + When a registry is set up (or created) by a :term:`Configurator`, the registry will be decorated with an instance named ``introspector`` implementing the :class:`pyramid.interfaces.IIntrospector` interface. @@ -27,28 +29,23 @@ This attribute is often accessed as ``request.registry.introspector`` in a typical Pyramid application. - This attribute is new as of :app:`Pyramid` 1.3. - .. class:: Introspectable + .. versionadded:: 1.3 + The default implementation of the interface :class:`pyramid.interfaces.IIntrospectable` used by framework exenders. An instance of this class is created when :attr:`pyramid.config.Configurator.introspectable` is called. - This class is new as of :app:`Pyramid` 1.3. - .. autoclass:: Deferred - This class is new as of :app:`Pyramid` 1.4. + .. versionadded:: 1.4 .. autofunction:: undefer - This function is new as of :app:`Pyramid` 1.4. + .. versionadded:: 1.4 .. autoclass:: predvalseq - This class is new as of :app:`Pyramid` 1.4. - - - + .. versionadded:: 1.4 -- cgit v1.2.3 From 4d059a786bc019673715754be58fd61dd8d5359c Mon Sep 17 00:00:00 2001 From: "David\\ Beitey" Date: Thu, 31 Jan 2013 13:27:38 +1000 Subject: Document PredicateMismatch for exception contexts --- docs/api/exceptions.rst | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/api') diff --git a/docs/api/exceptions.rst b/docs/api/exceptions.rst index 1dfbf46fd..ab158f18d 100644 --- a/docs/api/exceptions.rst +++ b/docs/api/exceptions.rst @@ -5,6 +5,8 @@ .. automodule:: pyramid.exceptions + .. autoclass:: PredicateMismatch + .. autoclass:: Forbidden .. autoclass:: NotFound -- cgit v1.2.3 From 268737d1e1162867e4324f3400acaf158675ad6a Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sat, 9 Feb 2013 14:16:49 +0200 Subject: grammar --- docs/api/request.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 9f1f71b31..7b843f86e 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -245,7 +245,7 @@ influence response values from a view that uses a renderer (such as the status code, a header, the content type, etc) you would set these attributes. See :ref:`response_prefixed_attrs` for further discussion. - As of Pyramid 1.1, assignment to ``response_*`` attrs are deprecated. + As of Pyramid 1.1, assignment to ``response_*`` attrs is deprecated. Assigning to one is still supported but will cause a deprecation warning to be emitted, and eventually the feature will be removed. For new code, instead of assigning ``response_*`` attributes to the -- cgit v1.2.3 From e81e76ae9e0fd1c45ddb61a873d67cd6e2d9f643 Mon Sep 17 00:00:00 2001 From: Georges Dubus Date: Thu, 14 Mar 2013 10:39:05 +0100 Subject: Added an options argument to pyramid.paste.get_appsettings, just like get_app, that can be used to get the settings when interpolation is used in the config file. --- docs/api/paster.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/paster.rst b/docs/api/paster.rst index bde128e05..edc3738fc 100644 --- a/docs/api/paster.rst +++ b/docs/api/paster.rst @@ -9,6 +9,6 @@ .. autofunction:: get_app(config_uri, name=None, options=None) - .. autofunction:: get_appsettings(config_uri, name=None) + .. autofunction:: get_appsettings(config_uri, name=None, options=None) .. autofunction:: setup_logging(config_uri) -- cgit v1.2.3 From aaedf52756cf1844deaea432e9c52d740d977789 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sun, 7 Apr 2013 18:55:18 +0200 Subject: fix some cross-references --- docs/api/request.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 7b843f86e..b1f5918d7 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -190,16 +190,16 @@ :meth:`~pyramid.config.Configurator.set_request_property`) on the request it's passed. - - causes a :class:`~pyramid.event.NewRequest` event to be sent at the + - causes a :class:`~pyramid.events.NewRequest` event to be sent at the beginning of request processing. - - causes a :class:`~pyramid.event.ContextFound` event to be sent + - causes a :class:`~pyramid.events.ContextFound` event to be sent when a context resource is found. - + - Ensures that the user implied by the request passed has the necessary authorization to invoke view callable before calling it. - - causes a :class:`~pyramid.event.NewResponse` event to be sent when + - causes a :class:`~pyramid.events.NewResponse` event to be sent when the Pyramid application returns a response. - Calls any :term:`response callback` functions defined within the -- cgit v1.2.3 From 32333e4d84fe0e71ce097a5dca57025353956dbe Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 24 Jul 2013 17:22:48 -0400 Subject: add not_ predicate feature --- docs/api/config.rst | 1 + 1 file changed, 1 insertion(+) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index 39d504348..1f65be9f1 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -135,3 +135,4 @@ will only exist for the lifetime of the actual applications for which they are being used. +.. autoclass:: not_ -- cgit v1.2.3 From 268e1d1d8168376700031678379fe356db96afea Mon Sep 17 00:00:00 2001 From: tisdall Date: Thu, 8 Aug 2013 14:30:44 -0400 Subject: changed "obect" to "object" --- docs/api/request.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index b1f5918d7..8958d2abc 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -156,7 +156,7 @@ .. attribute:: matched_route If a :term:`route` has matched during this request, this attribute will - be an obect representing the route matched by the URL pattern + be an object representing the route matched by the URL pattern associated with the route. If a route has not matched during this request, the value of this attribute will be ``None``. See :ref:`matched_route`. -- cgit v1.2.3 From 0240e91af1616be75305ac5b7a57099ef42210bf Mon Sep 17 00:00:00 2001 From: tisdall Date: Thu, 8 Aug 2013 14:36:10 -0400 Subject: "behavor" to "behavior" --- docs/api/request.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 8958d2abc..a90cb1ac0 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -238,7 +238,7 @@ .. attribute:: response_* In Pyramid 1.0, you could set attributes on a - :class:`pyramid.request.Request` which influenced the behavor of + :class:`pyramid.request.Request` which influenced the behavior of *rendered* responses (views which use a :term:`renderer` and which don't directly return a response). These attributes began with ``response_``, such as ``response_headerlist``. If you needed to -- cgit v1.2.3 From 9d0643063615ef7ce54fe062461c5dbf92cde3b4 Mon Sep 17 00:00:00 2001 From: Amos Latteier Date: Mon, 12 Aug 2013 16:04:00 -0400 Subject: Add documentation for creating and firing custom events. See issue #982. --- docs/api/registry.rst | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'docs/api') diff --git a/docs/api/registry.rst b/docs/api/registry.rst index db348495c..f96b23b68 100644 --- a/docs/api/registry.rst +++ b/docs/api/registry.rst @@ -29,6 +29,14 @@ This attribute is often accessed as ``request.registry.introspector`` in a typical Pyramid application. + .. method:: notify(*events) + + Fire one or more event. All event subscribers to the event(s) + will be notified. This method is often accessed as + ``request.registry.notify`` in Pyramid applications to fire + custom events. See :ref:`custom_events` for more information. + + .. class:: Introspectable .. versionadded:: 1.3 -- cgit v1.2.3 From 29ab2b964164844daa012c3e80d276f49ccbe217 Mon Sep 17 00:00:00 2001 From: Amos Latteier Date: Mon, 12 Aug 2013 16:45:11 -0400 Subject: Minor fixes suggested by @tshepang and @mmerickel thanks! --- docs/api/registry.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'docs/api') diff --git a/docs/api/registry.rst b/docs/api/registry.rst index f96b23b68..42a405a32 100644 --- a/docs/api/registry.rst +++ b/docs/api/registry.rst @@ -31,8 +31,9 @@ .. method:: notify(*events) - Fire one or more event. All event subscribers to the event(s) - will be notified. This method is often accessed as + Fire one or more events. All event subscribers to the event(s) + will be notified. The subscribers will be called synchronously on + the current thread. This method is often accessed as ``request.registry.notify`` in Pyramid applications to fire custom events. See :ref:`custom_events` for more information. -- cgit v1.2.3 From 8339cd1095be5e49fe41662e3618b8da6055a4f0 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Mon, 12 Aug 2013 16:28:57 -0500 Subject: remove the "thread" reference --- docs/api/registry.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'docs/api') diff --git a/docs/api/registry.rst b/docs/api/registry.rst index 42a405a32..7736cf075 100644 --- a/docs/api/registry.rst +++ b/docs/api/registry.rst @@ -32,10 +32,10 @@ .. method:: notify(*events) Fire one or more events. All event subscribers to the event(s) - will be notified. The subscribers will be called synchronously on - the current thread. This method is often accessed as - ``request.registry.notify`` in Pyramid applications to fire - custom events. See :ref:`custom_events` for more information. + will be notified. The subscribers will be called synchronously. + This method is often accessed as ``request.registry.notify`` + in Pyramid applications to fire custom events. See + :ref:`custom_events` for more information. .. class:: Introspectable -- cgit v1.2.3 From 330164c3190d92a3e1df89baafba12570d03bd32 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 29 Aug 2013 05:08:53 -0400 Subject: make local_name an attribute of Request, move logic from get_localizer into Request.localizer, fix docs; closes #1099 --- docs/api/request.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index a90cb1ac0..02290eaf3 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -311,6 +311,20 @@ .. versionadded:: 1.3 + .. attribute:: localizer + + A :term:`localizer` which will use the current locale name to + translate values. + + .. versionadded:: 1.5 + + .. attribute:: locale_name + + The locale name of the current request as computed by the + :term:`locale negotiator`. + + .. versionadded:: 1.5 + .. note:: For information about the API of a :term:`multidict` structure (such as -- cgit v1.2.3 From f6f1d1685f09f1ecd3717c90e687a6e3652b4fdc Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Thu, 5 Sep 2013 02:32:41 -0500 Subject: remove the deprecated request.response_* attributes --- docs/api/request.rst | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 02290eaf3..ef41ba4c8 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -235,24 +235,6 @@ .. automethod:: resource_path - .. attribute:: response_* - - In Pyramid 1.0, you could set attributes on a - :class:`pyramid.request.Request` which influenced the behavior of - *rendered* responses (views which use a :term:`renderer` and which - don't directly return a response). These attributes began with - ``response_``, such as ``response_headerlist``. If you needed to - influence response values from a view that uses a renderer (such as the - status code, a header, the content type, etc) you would set these - attributes. See :ref:`response_prefixed_attrs` for further discussion. - As of Pyramid 1.1, assignment to ``response_*`` attrs is deprecated. - Assigning to one is still supported but will cause a deprecation - warning to be emitted, and eventually the feature will be removed. For - new code, instead of assigning ``response_*`` attributes to the - request, use API of the :attr:`pyramid.request.Request.response` - object (exposed to view code as ``request.response``) to influence - rendered response behavior. - .. attribute:: json_body This property will return the JSON-decoded variant of the request -- cgit v1.2.3 From fc477b2e4b20ae2788e468e45b2831e774be8ced Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 7 Sep 2013 21:59:41 -0400 Subject: - The ``pyramid.events.NewResponse`` event is now sent **after** response callbacks are executed. It previously executed before response callbacks were executed. Rationale: it's more useful to be able to inspect the response after response callbacks have done their jobs instead of before. Closes #1116. --- docs/api/request.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index ef41ba4c8..72abddb68 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -199,13 +199,13 @@ - Ensures that the user implied by the request passed has the necessary authorization to invoke view callable before calling it. - - causes a :class:`~pyramid.events.NewResponse` event to be sent when - the Pyramid application returns a response. - - Calls any :term:`response callback` functions defined within the request's lifetime if a response is obtained from the Pyramid application. + - causes a :class:`~pyramid.events.NewResponse` event to be sent if a + response is obtained. + - Calls any :term:`finished callback` functions defined within the request's lifetime. -- cgit v1.2.3 From 2c4f4e3cbd1b5b56bb17d2348df3c397efd0a8e4 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 8 Sep 2013 20:39:39 -0400 Subject: - Removed the class named ``pyramid.view.static`` that had been deprecated since Pyramid 1.1. Instead use ``pyramid.static.static_view`` with ``use_subpath=True`` argument. --- docs/api/view.rst | 4 ---- 1 file changed, 4 deletions(-) (limited to 'docs/api') diff --git a/docs/api/view.rst b/docs/api/view.rst index 21d2bb90d..e79e1b505 100644 --- a/docs/api/view.rst +++ b/docs/api/view.rst @@ -25,8 +25,4 @@ .. autoclass:: forbidden_view_config :members: - .. autoclass:: static - :members: - :inherited-members: - -- cgit v1.2.3 From 780bbf9998fd805df55499ef4a78f41cbf99c7de Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 8 Sep 2013 20:45:33 -0400 Subject: - Removed the ``pyramid.view.is_response`` function that had been deprecated since Pyramid 1.1. Use the ``pyramid.request.Request.is_response`` method instead. --- docs/api/view.rst | 2 -- 1 file changed, 2 deletions(-) (limited to 'docs/api') diff --git a/docs/api/view.rst b/docs/api/view.rst index e79e1b505..d8e429552 100644 --- a/docs/api/view.rst +++ b/docs/api/view.rst @@ -11,8 +11,6 @@ .. autofunction:: render_view - .. autofunction:: is_response - .. autoclass:: view_config :members: -- cgit v1.2.3 From c6601f77f91dc933ca429d1448f4c6b27857b608 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 8 Sep 2013 22:52:54 -0400 Subject: - The ``renderer_globals_factory`` argument to the ``pyramid.config.Configurator` constructor and its ``setup_registry`` method has been removed. The ``set_renderer_globals_factory`` method of ``pyramid.config.Configurator`` has also been removed. The (internal) ``pyramid.interfaces.IRendererGlobals`` interface was also removed. These arguments, methods and interfaces had been deprecated since 1.1. Use a ``BeforeRender`` event subscriber as documented in the "Hooks" chapter of the Pyramid narrative documentation instead of providing renderer globals values to the configurator. --- docs/api/config.rst | 4 ---- 1 file changed, 4 deletions(-) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index 1f65be9f1..48dd2f0b9 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -52,10 +52,6 @@ .. automethod:: override_asset(to_override, override_with) - :methodcategory:`Setting Renderer Globals` - - .. automethod:: set_renderer_globals_factory(factory) - :methodcategory:`Getting and Adding Settings` .. automethod:: add_settings -- cgit v1.2.3 From 0905d2015e35e827c3fdb2135695710b80d549a5 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc" Date: Tue, 8 Oct 2013 11:50:11 -0500 Subject: Subclass HTTPBadCSRFToken from HTTPBadRequest and have request.session.check_csrf_token use the new exception. This supports a more fine-grained exception trapping. --- docs/api/httpexceptions.rst | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'docs/api') diff --git a/docs/api/httpexceptions.rst b/docs/api/httpexceptions.rst index 6a08d1048..0fdd0f0e9 100644 --- a/docs/api/httpexceptions.rst +++ b/docs/api/httpexceptions.rst @@ -7,9 +7,12 @@ .. attribute:: status_map - A mapping of integer status code to exception class (eg. the - integer "401" maps to - :class:`pyramid.httpexceptions.HTTPUnauthorized`). + A mapping of integer status code to HTTP exception class (eg. the integer + "401" maps to :class:`pyramid.httpexceptions.HTTPUnauthorized`). All + mapped exception classes are children of :class:`pyramid.httpexceptions`, + i.e. the :ref:`pyramid_specific_http_exceptions` such as + :class:`pyramid.httpexceptions.HTTPBadRequest.BadCSRFToken` are not + mapped. .. autofunction:: exception_response @@ -106,3 +109,13 @@ .. autoclass:: HTTPVersionNotSupported .. autoclass:: HTTPInsufficientStorage + + +.. _pyramid_specific_http_exceptions: + +Pyramid-specific HTTP Exceptions +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Each Pyramid-specific HTTP exception has the status code of it's parent. + + .. autoclass:: HTTPBadCSRFToken -- cgit v1.2.3 From 8df7a71d99bbeb7819e8a2752012d51202669aa6 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Sat, 19 Oct 2013 01:30:58 -0500 Subject: update the docs --- docs/api/session.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'docs/api') diff --git a/docs/api/session.rst b/docs/api/session.rst index 31bc196ad..dde9d20e9 100644 --- a/docs/api/session.rst +++ b/docs/api/session.rst @@ -5,12 +5,16 @@ .. automodule:: pyramid.session - .. autofunction:: UnencryptedCookieSessionFactoryConfig - .. autofunction:: signed_serialize .. autofunction:: signed_deserialize .. autofunction:: check_csrf_token + .. autofunction:: SignedCookieSessionFactory + + .. autofunction:: UnencryptedCookieSessionFactoryConfig + + .. autofunction:: BaseCookieSessionFactory + -- cgit v1.2.3 From 6b0889cc8f3711d5f77cb663f8f2fa432eb3ad06 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Sat, 19 Oct 2013 01:52:11 -0500 Subject: update doc references --- docs/api/exceptions.rst | 2 ++ docs/api/httpexceptions.rst | 13 ------------- 2 files changed, 2 insertions(+), 13 deletions(-) (limited to 'docs/api') diff --git a/docs/api/exceptions.rst b/docs/api/exceptions.rst index ab158f18d..0c630571f 100644 --- a/docs/api/exceptions.rst +++ b/docs/api/exceptions.rst @@ -5,6 +5,8 @@ .. automodule:: pyramid.exceptions + .. autoclass:: BadCSRFToken + .. autoclass:: PredicateMismatch .. autoclass:: Forbidden diff --git a/docs/api/httpexceptions.rst b/docs/api/httpexceptions.rst index 0fdd0f0e9..b50f10beb 100644 --- a/docs/api/httpexceptions.rst +++ b/docs/api/httpexceptions.rst @@ -10,9 +10,6 @@ A mapping of integer status code to HTTP exception class (eg. the integer "401" maps to :class:`pyramid.httpexceptions.HTTPUnauthorized`). All mapped exception classes are children of :class:`pyramid.httpexceptions`, - i.e. the :ref:`pyramid_specific_http_exceptions` such as - :class:`pyramid.httpexceptions.HTTPBadRequest.BadCSRFToken` are not - mapped. .. autofunction:: exception_response @@ -109,13 +106,3 @@ .. autoclass:: HTTPVersionNotSupported .. autoclass:: HTTPInsufficientStorage - - -.. _pyramid_specific_http_exceptions: - -Pyramid-specific HTTP Exceptions -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Each Pyramid-specific HTTP exception has the status code of it's parent. - - .. autoclass:: HTTPBadCSRFToken -- cgit v1.2.3 From b04ae5ac814266eb77d4a09c749e5e0394a11a1c Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Sat, 19 Oct 2013 03:43:05 -0500 Subject: modify the docs for the renderer interfaces --- docs/api/interfaces.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/interfaces.rst b/docs/api/interfaces.rst index 1dea5fab0..d8d935afd 100644 --- a/docs/api/interfaces.rst +++ b/docs/api/interfaces.rst @@ -50,7 +50,10 @@ Other Interfaces .. autointerface:: IRendererInfo :members: - .. autointerface:: ITemplateRenderer + .. autointerface:: IRendererFactory + :members: + + .. autointerface:: IRenderer :members: .. autointerface:: IViewMapperFactory -- cgit v1.2.3 From 0184b527725cfb634e4d57a1b033450fa8b24502 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 28 Oct 2013 15:26:31 -0400 Subject: Bring change log, API docs, and deprecations in line with normal policies/processes --- docs/api/request.rst | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 72abddb68..3d1fe020c 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -11,7 +11,10 @@ :exclude-members: add_response_callback, add_finished_callback, route_url, route_path, current_route_url, current_route_path, static_url, static_path, - model_url, resource_url, set_property + model_url, resource_url, set_property, + effective_principals, authenticated_userid, + unauthenticated_userid, has_permission, forget_userid, + remember_userid .. attribute:: context @@ -161,6 +164,42 @@ request, the value of this attribute will be ``None``. See :ref:`matched_route`. + .. attribute:: authenticated_userid + + .. versionadded:: 1.5 + + A property which returns the userid of the currently authenticated user + or ``None`` if there is no :term:`authentication policy` in effect or + there is no currently authenticated user. This differs from + :meth:`~pyramid.request.Request.unauthenticated_userid`, because the + effective authentication policy will have ensured that a record + associated with the userid exists in persistent storage; if it has + not, this value will be ``None``. + + .. attribute:: unauthenticated_userid + + .. versionadded:: 1.5 + + A property which returns a value which represents the *claimed* (not + verified) user id of the credentials present in the request. ``None`` if + there is no :term:`authentication policy` in effect or there is no user + data associated with the current request. This differs from + :meth:`~pyramid.request.Request.authenticated_userid`, because the + effective authentication policy will not ensure that a record associated + with the userid exists in persistent storage. Even if the userid + does not exist in persistent storage, this value will be the value + of the userid *claimed* by the request data. + + .. attribute:: effective_principals + + .. versionadded:: 1.5 + + A property which returns the list of 'effective' :term:`principal` + identifiers for this request. This will include the userid of the + currently authenticated user if a user is currently authenticated. If no + :term:`authentication policy` is in effect, this will return a sequence + containing only the :attr:`pyramid.security.Everyone` principal. + .. method:: invoke_subrequest(request, use_tweens=False) .. versionadded:: 1.4a1 @@ -215,6 +254,12 @@ request provided by e.g. the ``pshell`` environment. For more information, see :ref:`subrequest_chapter`. + .. automethod:: remember_userid + + .. automethod:: forget_userid + + .. automethod:: has_permission + .. automethod:: add_response_callback .. automethod:: add_finished_callback -- cgit v1.2.3 From e1838557e6721b5b42f1267b134b626099703c2c Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 30 Oct 2013 20:14:52 -0400 Subject: not methods, attrs --- docs/api/request.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 3d1fe020c..661cdfc91 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -171,7 +171,7 @@ A property which returns the userid of the currently authenticated user or ``None`` if there is no :term:`authentication policy` in effect or there is no currently authenticated user. This differs from - :meth:`~pyramid.request.Request.unauthenticated_userid`, because the + :attr:`~pyramid.request.Request.unauthenticated_userid`, because the effective authentication policy will have ensured that a record associated with the userid exists in persistent storage; if it has not, this value will be ``None``. @@ -184,7 +184,7 @@ verified) user id of the credentials present in the request. ``None`` if there is no :term:`authentication policy` in effect or there is no user data associated with the current request. This differs from - :meth:`~pyramid.request.Request.authenticated_userid`, because the + :attr:`~pyramid.request.Request.authenticated_userid`, because the effective authentication policy will not ensure that a record associated with the userid exists in persistent storage. Even if the userid does not exist in persistent storage, this value will be the value -- cgit v1.2.3 From 19d5fe09bb37d3694f63884eb5a95158f4252473 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Thu, 7 Nov 2013 00:00:38 -0600 Subject: document add_adapter --- docs/api/renderers.rst | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'docs/api') diff --git a/docs/api/renderers.rst b/docs/api/renderers.rst index ea000ad02..0caca02b4 100644 --- a/docs/api/renderers.rst +++ b/docs/api/renderers.rst @@ -13,8 +13,12 @@ .. autoclass:: JSON + .. automethod:: add_adapter + .. autoclass:: JSONP + .. automethod:: add_adapter + .. attribute:: null_renderer An object that can be used in advanced integration cases as input to the -- cgit v1.2.3 From 0dcd56c2c30863c6683c0cf442aa73dfdcd11b13 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sat, 9 Nov 2013 17:11:16 -0500 Subject: undeprecate remember/forget functions and remove remember_userid/forget_userid methods from request --- docs/api/request.rst | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 661cdfc91..b7604020e 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -13,8 +13,7 @@ current_route_path, static_url, static_path, model_url, resource_url, set_property, effective_principals, authenticated_userid, - unauthenticated_userid, has_permission, forget_userid, - remember_userid + unauthenticated_userid, has_permission .. attribute:: context @@ -254,10 +253,6 @@ request provided by e.g. the ``pshell`` environment. For more information, see :ref:`subrequest_chapter`. - .. automethod:: remember_userid - - .. automethod:: forget_userid - .. automethod:: has_permission .. automethod:: add_response_callback -- cgit v1.2.3 From 4f9eb3b50a363e86aa38f9c497983adca0264cb9 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sun, 9 Feb 2014 22:01:07 -0600 Subject: - correct error when building docs in Sphinx: Warning, treated as error: ~/projects/pyramid/pyramid/docs/api/i18n.rst:6: WARNING: error while formatting arguments for pyramid.i18n.TranslationStringFactory: 'function' object has no attribute '__bases__' --- docs/api/i18n.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/i18n.rst b/docs/api/i18n.rst index 53e8c8a9b..3b9abbc1d 100644 --- a/docs/api/i18n.rst +++ b/docs/api/i18n.rst @@ -7,7 +7,7 @@ .. autoclass:: TranslationString - .. autoclass:: TranslationStringFactory + .. autofunction:: TranslationStringFactory .. autoclass:: Localizer :members: -- cgit v1.2.3 From 2033eeb3602f330930585678aac926749b9c22f7 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Mon, 10 Feb 2014 03:22:33 -0600 Subject: - Garden PR #1121 --- docs/api/registry.rst | 5 ++++- docs/api/request.rst | 13 ++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'docs/api') diff --git a/docs/api/registry.rst b/docs/api/registry.rst index 7736cf075..bab3e26ba 100644 --- a/docs/api/registry.rst +++ b/docs/api/registry.rst @@ -21,7 +21,10 @@ When a registry is set up (or created) by a :term:`Configurator`, the registry will be decorated with an instance named ``introspector`` implementing the :class:`pyramid.interfaces.IIntrospector` interface. - See also :attr:`pyramid.config.Configurator.introspector`. + + .. seealso:: + + See also :attr:`pyramid.config.Configurator.introspector`. When a registry is created "by hand", however, this attribute will not exist until set up by a configurator. diff --git a/docs/api/request.rst b/docs/api/request.rst index b7604020e..343d0c022 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -250,8 +250,11 @@ ``invoke_subrequest`` isn't *actually* a method of the Request object; it's a callable added when the Pyramid router is invoked, or when a subrequest is invoked. This means that it's not available for use on a - request provided by e.g. the ``pshell`` environment. For more - information, see :ref:`subrequest_chapter`. + request provided by e.g. the ``pshell`` environment. + + .. seealso:: + + See also :ref:`subrequest_chapter`. .. automethod:: has_permission @@ -280,7 +283,11 @@ This property will return the JSON-decoded variant of the request body. If the request body is not well-formed JSON, or there is no body associated with this request, this property will raise an - exception. See also :ref:`request_json_body`. + exception. + + .. seealso:: + + See also :ref:`request_json_body`. .. method:: set_property(callable, name=None, reify=False) -- cgit v1.2.3 From 2af00e59d9c3e19b25e2759832efe6485a617536 Mon Sep 17 00:00:00 2001 From: flibustenet Date: Thu, 17 Apr 2014 21:52:23 +0200 Subject: More explicit example of set_property cleanup callback has a "request" parameter (and not "_") cleanup callback know (since 1.5) if an exception occurred or not (to commit or rollback) (same as #1302 on 1.5) --- docs/api/request.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 343d0c022..c52d41400 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -319,7 +319,13 @@ def _connect(request): conn = request.registry.dbsession() - def cleanup(_): + def cleanup(request): + # since version 1.5 request.exception is not more + # eagerly cleared + if request.exception is not None: + conn.rollback() + else: + conn.commit() conn.close() request.add_finished_callback(cleanup) return conn -- cgit v1.2.3 From 268eb40ff0e21281497a954120220e41bac4a4db Mon Sep 17 00:00:00 2001 From: thapar Date: Fri, 18 Apr 2014 04:52:01 -0400 Subject: Typo fix "not"-->"no" --- docs/api/request.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index c52d41400..b28ec5ffc 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -320,7 +320,7 @@ def _connect(request): conn = request.registry.dbsession() def cleanup(request): - # since version 1.5 request.exception is not more + # since version 1.5, request.exception is no more # eagerly cleared if request.exception is not None: conn.rollback() -- cgit v1.2.3 From 070d7a6abc67e942abffc6645d1efdcfb3b6dafe Mon Sep 17 00:00:00 2001 From: thapar Date: Fri, 18 Apr 2014 11:42:01 -0400 Subject: Corrected the comment's language --- docs/api/request.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index b28ec5ffc..77d80f6d6 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -320,8 +320,8 @@ def _connect(request): conn = request.registry.dbsession() def cleanup(request): - # since version 1.5, request.exception is no more - # eagerly cleared + # since version 1.5, request.exception is no + # longer eagerly cleared if request.exception is not None: conn.rollback() else: -- cgit v1.2.3 From f729a1e7f1efc27a6df1ae0eaca7fdffdd86ec2f Mon Sep 17 00:00:00 2001 From: Chris Rossi Date: Thu, 17 Jul 2014 16:04:28 -0400 Subject: Write the documentation. --- docs/api/interfaces.rst | 2 ++ docs/api/static.rst | 7 +++++++ 2 files changed, 9 insertions(+) (limited to 'docs/api') diff --git a/docs/api/interfaces.rst b/docs/api/interfaces.rst index d8d935afd..a62976d8a 100644 --- a/docs/api/interfaces.rst +++ b/docs/api/interfaces.rst @@ -86,3 +86,5 @@ Other Interfaces .. autointerface:: IResourceURL :members: + .. autointerface:: ICacheBuster + :members: diff --git a/docs/api/static.rst b/docs/api/static.rst index c28473584..8ea2fff75 100644 --- a/docs/api/static.rst +++ b/docs/api/static.rst @@ -9,3 +9,10 @@ :members: :inherited-members: + .. autoclass:: PathSegmentCacheBuster + :members: + + .. autoclass:: QueryStringCacheBuster + :members: + + .. autofunction:: Md5AssetTokenGenerator -- cgit v1.2.3 From aa96dda157d39c57c0d2fe8399db0b2175fa83d2 Mon Sep 17 00:00:00 2001 From: Chris Rossi Date: Fri, 18 Jul 2014 17:18:56 -0400 Subject: Take mcdonc's advice. This should be easier for users to understand. --- docs/api/static.rst | 2 -- 1 file changed, 2 deletions(-) (limited to 'docs/api') diff --git a/docs/api/static.rst b/docs/api/static.rst index 8ea2fff75..de5bcabda 100644 --- a/docs/api/static.rst +++ b/docs/api/static.rst @@ -14,5 +14,3 @@ .. autoclass:: QueryStringCacheBuster :members: - - .. autofunction:: Md5AssetTokenGenerator -- cgit v1.2.3 From f674a8f691d260d44e0f76e3afecfb15484c45b9 Mon Sep 17 00:00:00 2001 From: Chris Rossi Date: Mon, 28 Jul 2014 17:26:11 -0400 Subject: Mo' features, mo' problems. --- docs/api/static.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'docs/api') diff --git a/docs/api/static.rst b/docs/api/static.rst index de5bcabda..543e526ad 100644 --- a/docs/api/static.rst +++ b/docs/api/static.rst @@ -9,8 +9,11 @@ :members: :inherited-members: - .. autoclass:: PathSegmentCacheBuster + .. autoclass:: PathSegmentMd5CacheBuster :members: - .. autoclass:: QueryStringCacheBuster + .. autoclass:: QueryStringMd5CacheBuster + :members: + + .. autoclass:: QueryStringConstantCacheBuster :members: -- cgit v1.2.3 From 81719b800cfea1c6fd68427ea1d9c0a2f3e6c1dd Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc" Date: Tue, 12 Aug 2014 21:56:26 -0500 Subject: Docs: Make clear that a userid need not be a principal. --- docs/api/request.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 77d80f6d6..3a32fd938 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -194,10 +194,12 @@ .. versionadded:: 1.5 A property which returns the list of 'effective' :term:`principal` - identifiers for this request. This will include the userid of the - currently authenticated user if a user is currently authenticated. If no - :term:`authentication policy` is in effect, this will return a sequence - containing only the :attr:`pyramid.security.Everyone` principal. + identifiers for this request. This list typically includes the + :term:`userid` of the currently authenticated user if a user is + currently authenticated, but this depends on the + :term:`authentication policy` in effect. If no :term:`authentication + policy` is in effect, this will return a sequence containing only the + :attr:`pyramid.security.Everyone` principal. .. method:: invoke_subrequest(request, use_tweens=False) -- cgit v1.2.3 From dc324784193a577bc039dcddb0651ef5ec9e6f57 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc" Date: Tue, 12 Aug 2014 22:12:25 -0500 Subject: Docs: Make "userid" link to the glossary term. --- docs/api/request.rst | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 3a32fd938..4f93fa34f 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -167,27 +167,28 @@ .. versionadded:: 1.5 - A property which returns the userid of the currently authenticated user - or ``None`` if there is no :term:`authentication policy` in effect or - there is no currently authenticated user. This differs from - :attr:`~pyramid.request.Request.unauthenticated_userid`, because the - effective authentication policy will have ensured that a record - associated with the userid exists in persistent storage; if it has - not, this value will be ``None``. + A property which returns the :term:`userid` of the currently + authenticated user or ``None`` if there is no :term:`authentication + policy` in effect or there is no currently authenticated user. This + differs from :attr:`~pyramid.request.Request.unauthenticated_userid`, + because the effective authentication policy will have ensured that a + record associated with the :term:`userid` exists in persistent storage; if it + has not, this value will be ``None``. .. attribute:: unauthenticated_userid .. versionadded:: 1.5 A property which returns a value which represents the *claimed* (not - verified) user id of the credentials present in the request. ``None`` if - there is no :term:`authentication policy` in effect or there is no user - data associated with the current request. This differs from - :attr:`~pyramid.request.Request.authenticated_userid`, because the - effective authentication policy will not ensure that a record associated - with the userid exists in persistent storage. Even if the userid - does not exist in persistent storage, this value will be the value - of the userid *claimed* by the request data. + verified) :term:`userid` of the credentials present in the + request. ``None`` if there is no :term:`authentication policy` in effect + or there is no user data associated with the current request. This + differs from :attr:`~pyramid.request.Request.authenticated_userid`, + because the effective authentication policy will not ensure that a + record associated with the :term:`userid` exists in persistent storage. + Even if the :term:`userid` does not exist in persistent storage, this + value will be the value of the :term:`userid` *claimed* by the request + data. .. attribute:: effective_principals -- cgit v1.2.3 From fe83c6bfdab16818cb434d95a09bd6510b43aa24 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Wed, 13 Aug 2014 10:48:22 -0500 Subject: some tweaks to the usage of userid in the docs --- docs/api/request.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 4f93fa34f..dd68fa09c 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -172,8 +172,8 @@ policy` in effect or there is no currently authenticated user. This differs from :attr:`~pyramid.request.Request.unauthenticated_userid`, because the effective authentication policy will have ensured that a - record associated with the :term:`userid` exists in persistent storage; if it - has not, this value will be ``None``. + record associated with the :term:`userid` exists in persistent storage; + if it has not, this value will be ``None``. .. attribute:: unauthenticated_userid -- cgit v1.2.3 From 7a2b72c2ba018d6b75ee151843e37da67bbfc2bb Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Mon, 10 Nov 2014 01:34:38 -0600 Subject: update the public api for remember --- docs/api/security.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/security.rst b/docs/api/security.rst index 814b68e5a..88086dbbf 100644 --- a/docs/api/security.rst +++ b/docs/api/security.rst @@ -16,7 +16,7 @@ Authentication API Functions .. autofunction:: forget -.. autofunction:: remember +.. autofunction:: remember(request, userid, **kwargs) Authorization API Functions --------------------------- -- cgit v1.2.3 From 187fd8ed07693017d743351cfd58f1327c1abb08 Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Mon, 10 Nov 2014 01:05:39 -0700 Subject: Change autoclass to autoexception Fixes #1388 or part thereof --- docs/api/exceptions.rst | 12 +++--- docs/api/httpexceptions.rst | 94 ++++++++++++++++++++++----------------------- 2 files changed, 53 insertions(+), 53 deletions(-) (limited to 'docs/api') diff --git a/docs/api/exceptions.rst b/docs/api/exceptions.rst index 0c630571f..faca0fbb6 100644 --- a/docs/api/exceptions.rst +++ b/docs/api/exceptions.rst @@ -5,14 +5,14 @@ .. automodule:: pyramid.exceptions - .. autoclass:: BadCSRFToken + .. autoexception:: BadCSRFToken - .. autoclass:: PredicateMismatch + .. autoexception:: PredicateMismatch - .. autoclass:: Forbidden + .. autoexception:: Forbidden - .. autoclass:: NotFound + .. autoexception:: NotFound - .. autoclass:: ConfigurationError + .. autoexception:: ConfigurationError - .. autoclass:: URLDecodeError + .. autoexception:: URLDecodeError diff --git a/docs/api/httpexceptions.rst b/docs/api/httpexceptions.rst index b50f10beb..d4cf97f1d 100644 --- a/docs/api/httpexceptions.rst +++ b/docs/api/httpexceptions.rst @@ -13,96 +13,96 @@ .. autofunction:: exception_response - .. autoclass:: HTTPException + .. autoexception:: HTTPException - .. autoclass:: HTTPOk + .. autoexception:: HTTPOk - .. autoclass:: HTTPRedirection + .. autoexception:: HTTPRedirection - .. autoclass:: HTTPError + .. autoexception:: HTTPError - .. autoclass:: HTTPClientError + .. autoexception:: HTTPClientError - .. autoclass:: HTTPServerError + .. autoexception:: HTTPServerError - .. autoclass:: HTTPCreated + .. autoexception:: HTTPCreated - .. autoclass:: HTTPAccepted + .. autoexception:: HTTPAccepted - .. autoclass:: HTTPNonAuthoritativeInformation + .. autoexception:: HTTPNonAuthoritativeInformation - .. autoclass:: HTTPNoContent + .. autoexception:: HTTPNoContent - .. autoclass:: HTTPResetContent + .. autoexception:: HTTPResetContent - .. autoclass:: HTTPPartialContent + .. autoexception:: HTTPPartialContent - .. autoclass:: HTTPMultipleChoices + .. autoexception:: HTTPMultipleChoices - .. autoclass:: HTTPMovedPermanently + .. autoexception:: HTTPMovedPermanently - .. autoclass:: HTTPFound + .. autoexception:: HTTPFound - .. autoclass:: HTTPSeeOther + .. autoexception:: HTTPSeeOther - .. autoclass:: HTTPNotModified + .. autoexception:: HTTPNotModified - .. autoclass:: HTTPUseProxy + .. autoexception:: HTTPUseProxy - .. autoclass:: HTTPTemporaryRedirect + .. autoexception:: HTTPTemporaryRedirect - .. autoclass:: HTTPBadRequest + .. autoexception:: HTTPBadRequest - .. autoclass:: HTTPUnauthorized + .. autoexception:: HTTPUnauthorized - .. autoclass:: HTTPPaymentRequired + .. autoexception:: HTTPPaymentRequired - .. autoclass:: HTTPForbidden + .. autoexception:: HTTPForbidden - .. autoclass:: HTTPNotFound + .. autoexception:: HTTPNotFound - .. autoclass:: HTTPMethodNotAllowed + .. autoexception:: HTTPMethodNotAllowed - .. autoclass:: HTTPNotAcceptable + .. autoexception:: HTTPNotAcceptable - .. autoclass:: HTTPProxyAuthenticationRequired + .. autoexception:: HTTPProxyAuthenticationRequired - .. autoclass:: HTTPRequestTimeout + .. autoexception:: HTTPRequestTimeout - .. autoclass:: HTTPConflict + .. autoexception:: HTTPConflict - .. autoclass:: HTTPGone + .. autoexception:: HTTPGone - .. autoclass:: HTTPLengthRequired + .. autoexception:: HTTPLengthRequired - .. autoclass:: HTTPPreconditionFailed + .. autoexception:: HTTPPreconditionFailed - .. autoclass:: HTTPRequestEntityTooLarge + .. autoexception:: HTTPRequestEntityTooLarge - .. autoclass:: HTTPRequestURITooLong + .. autoexception:: HTTPRequestURITooLong - .. autoclass:: HTTPUnsupportedMediaType + .. autoexception:: HTTPUnsupportedMediaType - .. autoclass:: HTTPRequestRangeNotSatisfiable + .. autoexception:: HTTPRequestRangeNotSatisfiable - .. autoclass:: HTTPExpectationFailed + .. autoexception:: HTTPExpectationFailed - .. autoclass:: HTTPUnprocessableEntity + .. autoexception:: HTTPUnprocessableEntity - .. autoclass:: HTTPLocked + .. autoexception:: HTTPLocked - .. autoclass:: HTTPFailedDependency + .. autoexception:: HTTPFailedDependency - .. autoclass:: HTTPInternalServerError + .. autoexception:: HTTPInternalServerError - .. autoclass:: HTTPNotImplemented + .. autoexception:: HTTPNotImplemented - .. autoclass:: HTTPBadGateway + .. autoexception:: HTTPBadGateway - .. autoclass:: HTTPServiceUnavailable + .. autoexception:: HTTPServiceUnavailable - .. autoclass:: HTTPGatewayTimeout + .. autoexception:: HTTPGatewayTimeout - .. autoclass:: HTTPVersionNotSupported + .. autoexception:: HTTPVersionNotSupported - .. autoclass:: HTTPInsufficientStorage + .. autoexception:: HTTPInsufficientStorage -- cgit v1.2.3 From d89c5f76b3032a1447f19dc87a7a6ceb7508c3cb Mon Sep 17 00:00:00 2001 From: Hugo Branquinho Date: Tue, 25 Nov 2014 19:38:24 +0000 Subject: Documentation added --- docs/api/registry.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'docs/api') diff --git a/docs/api/registry.rst b/docs/api/registry.rst index bab3e26ba..57a80b3f5 100644 --- a/docs/api/registry.rst +++ b/docs/api/registry.rst @@ -14,6 +14,18 @@ accessed as ``request.registry.settings`` or ``config.registry.settings`` in a typical Pyramid application. + .. attribute:: package_name + + .. versionadded:: 1.6 + + When a registry is set up (or created) by a :term:`Configurator`, this + attribute will be the shortcut for + :attr:`pyramid.config.Configurator.package_name`. + + This attribute is often accessed as ``request.registry.package_name`` or + ``config.registry.package_name`` or ``config.package_name`` + in a typical Pyramid application. + .. attribute:: introspector .. versionadded:: 1.3 -- cgit v1.2.3 From cac2128fcc71ad2e0c9b9f22046dc47adb92dfd0 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Tue, 23 Dec 2014 03:23:19 -0800 Subject: - add an index to the API directory for better SEO --- docs/api/index.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 docs/api/index.rst (limited to 'docs/api') diff --git a/docs/api/index.rst b/docs/api/index.rst new file mode 100644 index 000000000..cb38aa0b2 --- /dev/null +++ b/docs/api/index.rst @@ -0,0 +1,12 @@ +.. _html_api_documentation: + +API Documentation +================= + +Comprehensive reference material for every public API exposed by :app:`Pyramid`: + +.. toctree:: + :maxdepth: 1 + :glob: + + * -- cgit v1.2.3 From da5f5f9ea02c2c9830c7ae016547d2bedd0e0171 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Sat, 7 Feb 2015 02:38:54 -0600 Subject: move the IResponseFactory into the public api --- docs/api/interfaces.rst | 3 +++ 1 file changed, 3 insertions(+) (limited to 'docs/api') 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: -- cgit v1.2.3 From 04cc91a7ac2d203e5acda41aa7c4975f78171274 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Mon, 16 Feb 2015 22:09:35 -0600 Subject: add InstancePropertyHelper and apply_request_extensions --- docs/api/request.rst | 1 + 1 file changed, 1 insertion(+) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index dd68fa09c..b325ad076 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -369,3 +369,4 @@ that used as ``request.GET``, ``request.POST``, and ``request.params``), see :class:`pyramid.interfaces.IMultiDict`. +.. autofunction:: apply_request_extensions(request) -- cgit v1.2.3 From 780889f18d17b86fc12625166a245c7f9947cbe6 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Tue, 17 Feb 2015 01:05:04 -0600 Subject: remove the token from the ICacheBuster api This exposes the QueryStringCacheBuster and PathSegmentCacheBuster public APIs alongside the md5-variants. These should be more cleanly subclassed by people wishing to extend their implementations. --- docs/api/static.rst | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'docs/api') diff --git a/docs/api/static.rst b/docs/api/static.rst index 543e526ad..b6b279139 100644 --- a/docs/api/static.rst +++ b/docs/api/static.rst @@ -9,6 +9,12 @@ :members: :inherited-members: + .. autoclass:: PathSegmentCacheBuster + :members: + + .. autoclass:: QueryStringCacheBuster + :members: + .. autoclass:: PathSegmentMd5CacheBuster :members: -- cgit v1.2.3 From 568a025d3156ee1e7bdf92e14c9eba7390c1dd26 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Tue, 17 Feb 2015 18:58:53 -0600 Subject: expose public config phases in pyramid.config --- docs/api/config.rst | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index 48dd2f0b9..ae913d32c 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -132,3 +132,8 @@ are being used. .. autoclass:: not_ + +.. attribute:: PHASE0_CONFIG +.. attribute:: PHASE1_CONFIG +.. attribute:: PHASE2_CONFIG +.. attribute:: PHASE3_CONFIG -- cgit v1.2.3 From ee632c60025bed98f4da097a38ca8bd282ddd705 Mon Sep 17 00:00:00 2001 From: uralbash Date: Thu, 28 May 2015 14:04:10 +0500 Subject: fix duplicate name resource_path --- docs/api/request.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index b325ad076..105ffb5a7 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -11,7 +11,7 @@ :exclude-members: add_response_callback, add_finished_callback, route_url, route_path, current_route_url, current_route_path, static_url, static_path, - model_url, resource_url, set_property, + model_url, resource_url, resource_path, set_property, effective_principals, authenticated_userid, unauthenticated_userid, has_permission -- cgit v1.2.3 From 02011f1f5d3fae6eac0209b5faccc06079dd1b41 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Tue, 20 Oct 2015 00:32:14 -0500 Subject: first cut at removing default cache busters --- docs/api/static.rst | 9 --------- 1 file changed, 9 deletions(-) (limited to 'docs/api') diff --git a/docs/api/static.rst b/docs/api/static.rst index b6b279139..e6d6e4618 100644 --- a/docs/api/static.rst +++ b/docs/api/static.rst @@ -9,17 +9,8 @@ :members: :inherited-members: - .. autoclass:: PathSegmentCacheBuster - :members: - .. autoclass:: QueryStringCacheBuster :members: - .. autoclass:: PathSegmentMd5CacheBuster - :members: - - .. autoclass:: QueryStringMd5CacheBuster - :members: - .. autoclass:: QueryStringConstantCacheBuster :members: -- cgit v1.2.3 From 31f3d86d3bf5db3c4aa5085c7b7a4d6396f29931 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Thu, 12 Nov 2015 00:55:38 -0600 Subject: complete cache buster docs using manifest example --- docs/api/static.rst | 3 +++ 1 file changed, 3 insertions(+) (limited to 'docs/api') diff --git a/docs/api/static.rst b/docs/api/static.rst index e6d6e4618..f3727e197 100644 --- a/docs/api/static.rst +++ b/docs/api/static.rst @@ -9,6 +9,9 @@ :members: :inherited-members: + .. autoclass:: ManifestCacheBuster + :members: + .. autoclass:: QueryStringCacheBuster :members: -- cgit v1.2.3 From 6f4e97603c2562914567a85bf18187299c3b543b Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Thu, 12 Nov 2015 20:04:28 -0600 Subject: Revert "fix/remove-default-cachebusters" This reverts commit 7410250313f893e5952bb2697324a4d4e3d47d22. This reverts commit cbec33b898efffbfa6acaf91cae45ec0daed4d7a. This reverts commit 345ca3052c395545b90fef9104a16eed5ab051a5, reversing changes made to 47162533af84bb8d26db6d1c9ba1e63d70e9070f. --- docs/api/static.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/static.rst b/docs/api/static.rst index f3727e197..b6b279139 100644 --- a/docs/api/static.rst +++ b/docs/api/static.rst @@ -9,11 +9,17 @@ :members: :inherited-members: - .. autoclass:: ManifestCacheBuster + .. autoclass:: PathSegmentCacheBuster :members: .. autoclass:: QueryStringCacheBuster :members: + .. autoclass:: PathSegmentMd5CacheBuster + :members: + + .. autoclass:: QueryStringMd5CacheBuster + :members: + .. autoclass:: QueryStringConstantCacheBuster :members: -- cgit v1.2.3 From 3a41196208c7fd78cfb177bb5105c6a702436b78 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Tue, 20 Oct 2015 00:32:14 -0500 Subject: update cache buster prose and add ManifestCacheBuster redux of #2013 --- docs/api/static.rst | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'docs/api') diff --git a/docs/api/static.rst b/docs/api/static.rst index b6b279139..f3727e197 100644 --- a/docs/api/static.rst +++ b/docs/api/static.rst @@ -9,17 +9,11 @@ :members: :inherited-members: - .. autoclass:: PathSegmentCacheBuster + .. autoclass:: ManifestCacheBuster :members: .. autoclass:: QueryStringCacheBuster :members: - .. autoclass:: PathSegmentMd5CacheBuster - :members: - - .. autoclass:: QueryStringMd5CacheBuster - :members: - .. autoclass:: QueryStringConstantCacheBuster :members: -- cgit v1.2.3 From ee9c620963553a3a959cdfc517f1e0818a21e9c0 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Mon, 23 Nov 2015 12:59:55 -0600 Subject: expose the PickleSerializer --- docs/api/session.rst | 1 + 1 file changed, 1 insertion(+) (limited to 'docs/api') diff --git a/docs/api/session.rst b/docs/api/session.rst index dde9d20e9..474e2bb32 100644 --- a/docs/api/session.rst +++ b/docs/api/session.rst @@ -17,4 +17,5 @@ .. autofunction:: BaseCookieSessionFactory + .. autoclass:: PickleSerializer -- cgit v1.2.3 From bc092500e047d14a8ca1a97f1abc00a5678748fd Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Thu, 3 Mar 2016 20:14:09 -0600 Subject: link invoke_exception_view to api docs --- docs/api/request.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/request.rst b/docs/api/request.rst index 105ffb5a7..52bf50078 100644 --- a/docs/api/request.rst +++ b/docs/api/request.rst @@ -13,7 +13,8 @@ current_route_path, static_url, static_path, model_url, resource_url, resource_path, set_property, effective_principals, authenticated_userid, - unauthenticated_userid, has_permission + unauthenticated_userid, has_permission, + invoke_exception_view .. attribute:: context @@ -259,6 +260,8 @@ See also :ref:`subrequest_chapter`. + .. automethod:: invoke_exception_view + .. automethod:: has_permission .. automethod:: add_response_callback -- cgit v1.2.3 From e4b931a67455f14d84d415be49e6596d06cc0a42 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Wed, 9 Mar 2016 00:46:59 -0600 Subject: add options support to view derivers exposed a new IViewDeriver api with an optional ``options`` list to expose support for new kwargs that may be passed to config.add_view --- docs/api/interfaces.rst | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'docs/api') diff --git a/docs/api/interfaces.rst b/docs/api/interfaces.rst index de2a664a4..635d3c5b6 100644 --- a/docs/api/interfaces.rst +++ b/docs/api/interfaces.rst @@ -91,3 +91,9 @@ Other Interfaces .. autointerface:: ICacheBuster :members: + + .. autointerface:: IViewDeriver + :members: + + .. autointerface:: IViewDeriverInfo + :members: -- cgit v1.2.3 From 35e632635b1b4e0a767024689d69d9469ae98c0f Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Mon, 14 Mar 2016 23:28:15 -0500 Subject: add a docstring for add_view_deriver and expose the method to the api docs --- docs/api/config.rst | 1 + 1 file changed, 1 insertion(+) (limited to 'docs/api') diff --git a/docs/api/config.rst b/docs/api/config.rst index ae913d32c..e083dbc68 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -66,6 +66,7 @@ .. automethod:: add_tween .. automethod:: add_route_predicate .. automethod:: add_view_predicate + .. automethod:: add_view_deriver .. automethod:: set_request_factory .. automethod:: set_root_factory .. automethod:: set_session_factory -- cgit v1.2.3 From 1514ea003dfe39fa79a0ec07bbbc14f239cb4eb2 Mon Sep 17 00:00:00 2001 From: Marc Abramowitz Date: Mon, 7 Mar 2016 08:20:39 -0800 Subject: Pass vars to logging.config.fileConfig This allows one to set up a logging configuration that is parameterized based on variables specified on the command-line. e.g.: the application .ini file could have: ```ini [logger_root] level = %(LOGGING_LOGGER_ROOT_LEVEL)s handlers = console [handler_console] class = StreamHandler args = (sys.stderr,) level = %(LOGGING_HANDLER_CONSOLE_LEVEL)s formatter = generic ``` This app could be launched with: ``` pserve development.ini LOGGING_LOGGER_ROOT_LEVEL=DEBUG LOGGING_HANDLER_CONSOLE_LEVEL=DEBUG ``` --- docs/api/paster.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/api') diff --git a/docs/api/paster.rst b/docs/api/paster.rst index edc3738fc..27bc81a1f 100644 --- a/docs/api/paster.rst +++ b/docs/api/paster.rst @@ -11,4 +11,4 @@ .. autofunction:: get_appsettings(config_uri, name=None, options=None) - .. autofunction:: setup_logging(config_uri) + .. autofunction:: setup_logging(config_uri, global_conf=None) -- cgit v1.2.3 From a3db3cab713fecc0c83c742cfe3f0736b1d94a92 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Thu, 7 Apr 2016 01:16:45 -0500 Subject: separate the viewderiver module and allow overriding the mapper --- docs/api/viewderivers.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 docs/api/viewderivers.rst (limited to 'docs/api') diff --git a/docs/api/viewderivers.rst b/docs/api/viewderivers.rst new file mode 100644 index 000000000..a4ec107b6 --- /dev/null +++ b/docs/api/viewderivers.rst @@ -0,0 +1,16 @@ +.. _viewderivers_module: + +:mod:`pyramid.viewderivers` +--------------------------- + +.. automodule:: pyramid.viewderivers + + .. attribute:: INGRESS + + Constant representing the request ingress, for use in ``under`` + arguments to :meth:`pyramid.config.Configurator.add_view_deriver`. + + .. attribute:: MAPPED_VIEW + + Constant representing the closest view deriver, for use in ``over`` + arguments to :meth:`pyramid.config.Configurator.add_view_deriver`. -- cgit v1.2.3 From c231d8174e811eec5a3faeafa5aee60757c6d31f Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Fri, 8 Apr 2016 00:47:01 -0500 Subject: update constraints for derivers as well as docs --- docs/api/viewderivers.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'docs/api') diff --git a/docs/api/viewderivers.rst b/docs/api/viewderivers.rst index a4ec107b6..2a141501e 100644 --- a/docs/api/viewderivers.rst +++ b/docs/api/viewderivers.rst @@ -10,7 +10,8 @@ Constant representing the request ingress, for use in ``under`` arguments to :meth:`pyramid.config.Configurator.add_view_deriver`. - .. attribute:: MAPPED_VIEW + .. attribute:: VIEW - Constant representing the closest view deriver, for use in ``over`` - arguments to :meth:`pyramid.config.Configurator.add_view_deriver`. + Constant representing the :term:`view callable` at the end of the view + pipeline, for use in ``over`` arguments to + :meth:`pyramid.config.Configurator.add_view_deriver`. -- cgit v1.2.3 From 732d80b476ccc883fc7b6209a4256ef97946e1eb Mon Sep 17 00:00:00 2001 From: Bert JW Regeer Date: Sun, 10 Apr 2016 21:55:52 -0600 Subject: Add API docs for BeforeTraversal --- docs/api/events.rst | 2 ++ docs/api/interfaces.rst | 3 +++ 2 files changed, 5 insertions(+) (limited to 'docs/api') diff --git a/docs/api/events.rst b/docs/api/events.rst index 31a0e22c1..0a8463740 100644 --- a/docs/api/events.rst +++ b/docs/api/events.rst @@ -21,6 +21,8 @@ Event Types .. autoclass:: ContextFound +.. autoclass:: BeforeTraversal + .. autoclass:: NewResponse .. autoclass:: BeforeRender diff --git a/docs/api/interfaces.rst b/docs/api/interfaces.rst index 635d3c5b6..272820a91 100644 --- a/docs/api/interfaces.rst +++ b/docs/api/interfaces.rst @@ -17,6 +17,9 @@ Event-Related Interfaces .. autointerface:: IContextFound :members: + .. autointerface:: IBeforeTraversal + :members: + .. autointerface:: INewResponse :members: -- cgit v1.2.3 From 65dee6e4ca0c0c607e97db0c9e55768f10591a58 Mon Sep 17 00:00:00 2001 From: Donald Stufft Date: Fri, 15 Apr 2016 20:42:20 -0400 Subject: In addition to CSRF token, verify the origin too Add an additional layer of protection against CSRF by verifying the actual origin of the request in addition to the CSRF token. We only do this check on sites hosted behind HTTPS because only HTTPS sites have evidence to show that the Referrer header is not being spuriously removed by random middleware boxes. --- docs/api/exceptions.rst | 2 ++ docs/api/session.rst | 2 ++ 2 files changed, 4 insertions(+) (limited to 'docs/api') diff --git a/docs/api/exceptions.rst b/docs/api/exceptions.rst index faca0fbb6..cb411458d 100644 --- a/docs/api/exceptions.rst +++ b/docs/api/exceptions.rst @@ -5,6 +5,8 @@ .. automodule:: pyramid.exceptions + .. autoexception:: BadCSRFOrigin + .. autoexception:: BadCSRFToken .. autoexception:: PredicateMismatch diff --git a/docs/api/session.rst b/docs/api/session.rst index 474e2bb32..56c4f52d7 100644 --- a/docs/api/session.rst +++ b/docs/api/session.rst @@ -9,6 +9,8 @@ .. autofunction:: signed_deserialize + .. autofunction:: check_csrf_origin + .. autofunction:: check_csrf_token .. autofunction:: SignedCookieSessionFactory -- cgit v1.2.3