summaryrefslogtreecommitdiff
path: root/docs/api/interfaces.rst
AgeCommit message (Collapse)Author
2017-04-12Rename implementation to ICSRFStoragePolicyMatthew Wilkes
2017-04-12Fix tests and documentation in various places, and feedback following reviewJure Cerjak
regarding naming of variables and code cleanup.
2017-04-12Create a new ICSRF implementation for getting CSRF tokens, split out from ↵Matthew Wilkes
the session machinery. Adds configuration of this to the csrf_options configurator commands. Make the default implementation a fallback to the old one. Documentation patches for new best practices given updates CSRF implementation.
2017-02-25add an IExecutionPolicy that can wrap the routerMichael Merickel
2016-05-10expose the IRequestFactory interfaceMichael Merickel
2016-04-10Add API docs for BeforeTraversalBert JW Regeer
2016-03-09add options support to view deriversMichael Merickel
exposed a new IViewDeriver api with an optional ``options`` list to expose support for new kwargs that may be passed to config.add_view
2015-02-07move the IResponseFactory into the public apiMichael Merickel
2014-07-17Write the documentation.Chris Rossi
2013-10-19modify the docs for the renderer interfacesMichael Merickel
2012-02-17FeaturesChris McDonough
-------- - 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.
2012-02-07add asset descriptor interfaceChris McDonough
2011-11-30add tests for introspectable; add more interface docs and expose actioninfoChris McDonough
2011-11-30docs; todo; coverage for IntrospectorChris McDonough
2011-08-14- Added the ``pyramid.interfaces.IDict`` interface representing the methodsChris McDonough
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.
2011-08-10show members for event interfacesChris McDonough
2011-06-13- Remove IResponder abstraction in favor of more general IResponseChris McDonough
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.
2011-06-04- It is now possible to control how the Pyramid router calls the WSGIChris McDonough
``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
2011-05-13- Added documentation for a "multidict" (e.g. the API of ``request.POST``) asChris McDonough
interface API documentation.
2011-04-13- Make ``pyramid.interfaces.IAuthenticationPolicy`` andChris McDonough
``pyramid.interfaces.IAuthorizationPolicy`` public interfaces, and refer to them within the ``pyramid.authentication`` and ``pyramid.authorization`` API docs. - Render the function definitions for each exposed interface in ``pyramid.interfaces``. Closes #167.
2010-12-29factor deriver from mapperChris McDonough
2010-12-22change flash API as per email convo with Ben and MikeChris McDonough
2010-12-22- Added flash messaging, as described in the "Flash Messaging" narrativeChris McDonough
documentation chapter.
2010-11-21- Add ``pyramid.interfaces.ITemplateRenderer`` interface to Interfaces APIChris McDonough
chapter (has ``implementation()`` method, required to be used when getting at Chameleon macros).
2010-11-02- New event type: ``pyramid.interfaces.IBeforeRender``. An object of this typeChris McDonough
is sent as an event before a renderer is invoked (but after the application-level renderer globals factory added via ``pyramid.configurator.configuration.set_renderer_globals_factory``, if any, has injected its own keys). Applications may now subscribe to the ``IBeforeRender`` event type in order to introspect the and modify the set of renderer globals before they are passed to a renderer. The event object iself has a dictionary-like interface that can be used for this purpose. For example:: from repoze.events import subscriber from pyramid.interfaces import IRendererGlobalsEvent @subscriber(IRendererGlobalsEvent) def add_global(event): event['mykey'] = 'foo' If a subscriber attempts to add a key that already exist in the renderer globals dictionary, a ``KeyError`` is raised. This limitation is due to the fact that subscribers cannot be ordered relative to each other. The set of keys added to the renderer globals dictionary by all subscribers and app-level globals factories must be unique.
2010-11-01document IRendererInfo in API docsChris McDonough
2010-10-28sessioning docsChris McDonough
2010-10-25convert API docs to PyramidChris McDonough
2010-09-14- The ``add_route`` method of a Configurator now accepts aChris McDonough
``pregenerator`` argument. The pregenerator for the resulting route is called by ``route_url`` in order to adjust the set of arguments passed to it by the user for special purposes, such as Pylons 'subdomain' support. It will influence the URL returned by ``route_url``. See the ``repoze.bfg.interfaces.IRoutePregenerator`` interface for more information.
2010-09-12- The BFG router now emits an additional event unconditionally at theChris McDonough
end of request processing: ``repoze.bfg.interfaces.IFinishedRequest``. This event is meant to be used when it is necessary to perform unconditional cleanup after request processing. See the ``repoze.bfg.events.FinishedRequest`` class documentation for more information. - The ``repoze.bfg.interfaces.IWSGIApplicationCreatedEvent`` event interface was renamed to ``repoze.bfg.interfaces.IApplicationCreated``. Likewise, the ``repoze.bfg.events.WSGIApplicationCreatedEvent`` class was renamed to ``repoze.bfg.events.ApplicationCreated``. The older aliases will continue to work indefinitely. - The ``repoze.bfg.interfaces.IAfterTraversal`` event interface was renamed to ``repoze.bfg.interfaces.IContextFound``. Likewise, the ``repoze.bfg.events.AfterTraveral`` class was renamed to ``repoze.bfg.events.ContextFound``. The older aliases will continue to work indefinitely.
2010-09-08dont expose this until necessaryChris McDonough
2010-09-08- The ``repoze.bfg.interfaces`` API documentation page is now renderedChris McDonough
via ``repoze.sphinx.autointerface``. - The URL Dispatch narrative chapter now refers to the ``interfaces`` chapter to explain the API of an ``IRoute`` object. - ``tests_require`` now includes ``repoze.sphinx.autointerface`` as a dependency.
2010-08-08- New public interface: ``repoze.bfg.exceptions.IExceptionResponse``.Chris McDonough
This interface is provided by all internal exception classes (such as ``repoze.bfg.exceptions.NotFound`` and ``repoze.bfg.exceptions.Forbidden``), instances of which are both exception objects and can behave as WSGI response objects. This interface is made public so that exception classes which are also valid WSGI response factories can be configured to implement them or exception instances which are also or response instances can be configured to provide them. - New API class: ``repoze.bfg.view.AppendSlashNotFoundViewFactory`` (undoes previous custom_notfound_view on request passsed to append_slash_notfound_view). - Previously, two default view functions were registered at Configurator setup (one for ``repoze.bfg.exceptions.NotFound`` named ``default_notfound_view`` and one for ``repoze.bfg.exceptions.Forbidden`` named ``default_forbidden_view``) to render internal exception responses. Those default view functions have been removed, replaced with a generic default view function which is registered at Configurator setup for the ``repoze.bfg.interfaces.IExceptionResponse`` interface that simply returns the exception instance; the ``NotFound` and ``Forbidden`` classes are now still exception factories but they are also response factories which generate instances that implement the new ``repoze.bfg.interfaces.IExceptionResponse`` interface.
2009-12-23- Added the ``repoze.bfg.authentication``,Chris McDonough
``repoze.bfg.authorization``, and ``repoze.bfg.interfaces`` modules to API documentation.
2009-07-03API docs audit.Chris McDonough
2009-01-12- An interface specific to the HTTP verb (GET/PUT/POST/DELETE/HEAD) isChris McDonough
attached to each request object on ingress. The HTTP-verb-related interfaces are defined in ``repoze.bfg.interfaces`` and are ``IGETRequest``, ``IPOSTRequest``, ``IPUTRequest``, ``IDELETERequest`` and ``IHEADRequest``. These interfaces can be specified as the ``request_type`` attribute of a bfg view declaration. A view naming a specific HTTP-verb-matching interface will be found only if the view is defined with a request_type that matches the HTTP verb in the incoming request. The more general ``IRequest`` interface can be used as the request_type to catch all requests (and this is indeed the default). All requests implement ``IRequest``. The HTTP-verb-matching idea was pioneered by `repoze.bfg.restrequest <http://pypi.python.org/pypi/repoze.bfg.restrequest/1.0.1>`_ . That package is no longer required, but still functions fine.