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