summaryrefslogtreecommitdiff
path: root/docs/api/request.rst
AgeCommit message (Collapse)Author
2016-03-03link invoke_exception_view to api docsMichael Merickel
2015-05-28fix duplicate name resource_pathuralbash
2015-02-16add InstancePropertyHelper and apply_request_extensionsMichael Merickel
2014-08-13some tweaks to the usage of userid in the docsMichael Merickel
2014-08-12Docs: Make "userid" link to the glossary term.Karl O. Pinc
2014-08-12Docs: Make clear that a userid need not be a principal.Karl O. Pinc
2014-04-18Corrected the comment's languagethapar
2014-04-18Typo fix "not"-->"no"thapar
2014-04-17More explicit example of set_propertyflibustenet
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)
2014-02-10- Garden PR #1121Steve Piercy
2013-11-09undeprecate remember/forget functions and remove ↵Chris McDonough
remember_userid/forget_userid methods from request
2013-10-30not methods, attrsChris McDonough
2013-10-28Bring change log, API docs, and deprecations in line with normal ↵Chris McDonough
policies/processes
2013-09-07- The ``pyramid.events.NewResponse`` event is now sent **after** responseChris McDonough
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.
2013-09-05remove the deprecated request.response_* attributesMichael Merickel
2013-08-29make local_name an attribute of Request, move logic from get_localizer into ↵Chris McDonough
Request.localizer, fix docs; closes #1099
2013-08-08"behavor" to "behavior"tisdall
2013-08-08changed "obect" to "object"tisdall
2013-04-07fix some cross-referencesTshepang Lekhonkhobe
2013-02-09grammarTshepang Lekhonkhobe
2013-01-29replace 'note' with the more correct 'versionadded' directiveTshepang Lekhonkhobe
2013-01-01eliminate repeated "the" wordsTshepang Lekhonkhobe
2012-09-16make use_tweens=False the defaultChris McDonough
2012-09-16make use_tweens=True the default, add some more testsChris McDonough
2012-09-16rename subrequest to invoke_subrequestChris McDonough
2012-09-16docs and testChris McDonough
2012-09-16add docsChris McDonough
2012-02-24docs-deprecate tmpl_contextChris McDonough
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-01-11Renamed the func to callable in the docs.Michael Merickel
2011-12-30Documented Request.set_property.Michael Merickel
2011-08-20add static_path function to url and static_path method to requestChris McDonough
2011-08-20- New request methods: ``current_route_url``, ``current_route_path``.Chris McDonough
- New function in ``pyramid.url``: ``current_route_path``.
2011-07-31- A new attribute is available on request objects: ``exc_info``. Its valueChris McDonough
will be ``None`` until an exception is caught by the Pyramid router, after which it will be the result of ``sys.exc_info()``.
2011-07-24back this feature out; we'll try a different approachChris McDonough
2011-07-23- New method: ``pyramid.request.Request.add_view_mapper``. A view wrapper isChris McDonough
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.
2011-07-09request.json -> request.json_body; add some docs for json_bodyChris McDonough
2011-07-04- New request attribute: ``json``. If the request's ``content_type`` isChris McDonough
``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``.
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-05-13- Added documentation for a "multidict" (e.g. the API of ``request.POST``) asChris McDonough
interface API documentation.
2011-04-19renderingChris McDonough
2011-04-19renderingChris McDonough
2011-04-19clarifyChris McDonough
2011-04-18- Deprecated all assignments to ``request.response_*`` attributes such asChris McDonough
``request.response_content_type = 'foo'``. Assignments and mutations of the following request attributes that were considered by the framework for response influence are now deprecated: ``response_content_type``, ``response_headerlist``, ``response_status``, ``response_charset``, and ``response_cache_for``. Instead of assigning these to the request object for detection by the rendering machinery, users should use the appropriate API of the Response object created by accessing ``request.response`` (e.g. ``request.response_content_type = 'abc'`` -> ``request.response.content_type = 'abc'``). - Custom request objects are now required to have a ``response`` attribute (or reified property) if they are meant to be used with renderers. This ``response`` attribute should be an instance of the class ``pyramid.response.Response``. - The JSON and string renderer factories now use ``request.response.content_type`` rather than ``request.response_content_type``. They determine whether they should set the content type of the response by comparing the response's content type against the default (usually ``text/html``); if the content type is not the default, the renderer changes the content type (to ``application/json`` or ``text/plain`` for JSON and string renderers respectively). - Made it possible to assign to and delete ``pyramid.testing.DummyRequest.registry`` (bugfix).
2011-03-09leave some breadcrumbs for finding renderered response attribute settingsChris McDonough
2011-01-21- Add docs for ``add_finished_callback``, ``add_response_callback``,Chris McDonough
``route_path``, ``route_url``, and ``static_url`` methods to ``pyramid.request.Request`` API docs.
2010-12-18resource -> assetChris McDonough
2010-11-10- New API methods for ``pyramid.request.Request``: ``model_url`` andChris McDonough
``route_url``. These are simple passthroughs for their respective functions in ``pyramid.url``. - Documented the ``matchdict`` and ``matched_route`` attributes of the request object in the Request API documentation.
2010-11-09- All references to Pyramid-the-application were changed from :mod:`pyramid`Chris McDonough
to :app:`Pyramid`. A custom role setting was added to ``docs/conf.py`` to allow for this. (internal)
2010-10-29pylons paster templatesChris McDonough