Subscribers to this event may introspect and modify the set of
renderer globals before they are passed to a renderer.
The event object itself provides a dictionary-like interface for adding
and removing renderer globals. The keys and values of the
dictionary are those globals. For example:

Return a sequence representing the effective principals
typically including the userid and any groups belonged
to by the current user, always including 'system' groups such
as pyramid.security.Everyone and
pyramid.security.Authenticated.

Return a set of headers suitable for 'remembering' the
userid named userid when set in a response. An
individual authentication policy and its consumers can
decide on the composition and meaning of **kw.

Return the authenticated userid or None if
no authenticated userid can be found. This method of the
policy should ensure that a record exists in whatever
persistent store is used related to the user (the user
should not have been deleted); if a record associated with
the current id does not exist in a persistent store, it
should return None.

Return the unauthenticated userid. This method
performs the same duty as authenticated_userid but is
permitted to return the userid based only on data present
in the request; it needn't (and shouldn't) check any
persistent store to ensure that the user record related to
the request userid exists.

This method is intended primarily a helper to assist the
authenticated_userid method in pulling credentials out
of the request data, abstracting away the specific headers,
query strings, etc that are used to authenticate the request.

Return a set of principal identifiers allowed by the
permission in context. This behavior is optional; if you
choose to not implement it you should define this method as
something which raises a NotImplementedError. This method
will only be called when the
pyramid.security.principals_allowed_by_permission API is
used.

If the path passed to this function can be matched by the
pattern of this route, return a dictionary (the
'matchdict'), which will contain keys representing the dynamic
segment markers in the pattern mapped to values extracted from
the provided path.

If the path passed to this function cannot be matched by
the pattern of this route, return None.

A pregenerator is a function associated by a developer with a
route. The pregenerator for a route is called by
pyramid.request.Request.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.

A pregenerator should return a two-tuple of (elements,kw)
after examining the originals passed to this function, which
are the arguments (request,elements,kw). The simplest
pregenerator is:

Return a cross-site request forgery protection token. It
will be an ascii-compatible unicode string. If a token was previously
set for this user via new_csrf_token, that token will be returned.
If no CSRF token was previously set, new_csrf_token will be
called, which will create and set a token, and this token will be
returned.

Determine if the supplied token is valid. Most implementations
should simply compare the token to the current value of
get_csrf_token but it is possible to verify the token using
any mechanism necessary using this method.

Changed in version 1.9: Sessions are no longer required to implement get_csrf_token and
new_csrf_token. CSRF token support was moved to the pluggable
pyramid.interfaces.ICSRFStoragePolicy configuration hook.

Mark the session as changed. A user of a session should
call this method after he or she mutates a mutable object that
is a value of the session (it should not be required after
mutating the session itself). For example, if the user has
stored a dictionary in the session under the key foo, and
he or she does session['foo']={}, changed() needn't
be called. However, if subsequently he or she does
session['foo']['a']=1, changed() must be called for
the sessioning machinery to notice the mutation of the
internal dictionary.

Push a flash message onto the end of the flash queue represented
by queue. An alternate flash message queue can used by passing
an optional queue, which must be a string. If
allow_duplicate is false, if the msg already exists in the
queue, it will not be re-added.

Pop a queue from the flash storage. The queue is removed from
flash storage after this message is called. The queue is returned;
it is a list of flash messages added by
pyramid.interfaces.ISession.flash()

Peek at a queue in the flash storage. The queue remains in
flash storage after this message is called. The queue is returned;
it is a list of flash messages added by
pyramid.interfaces.ISession.flash()

Invalidate the session. The action caused by
invalidate is implementation-dependent, but it should have
the effect of completely dissociating any data stored in the
session with the current request. It might set response
values (such as one which clears a cookie), or it might not.

An invalidated session may be used after the call to invalidate
with the effect that a new session is created to store the data. This
enables workflows requiring an entirely new session, such as in the
case of changing privilege levels or preventing fixation attacks.

Call the renderer with the result of the
view (value) passed in and return a result (a string or
unicode object useful as a response body). Values computed by
the system are passed by the system in the system
parameter, which is a dictionary. Keys in the dictionary
include: view (the view callable that returned the value),
renderer_name (the template name or simple name of the
renderer), context (the context object passed to the
view), and request (the request object passed to the
view).

The request context is used to push/pop the threadlocals required
when processing the request. It also contains an initialized
pyramid.interfaces.IRequest instance using the registered
pyramid.interfaces.IRequestFactory. The context may be
used as a context manager to control the threadlocal lifecycle:

withrouter.request_context(environ)asrequest:...

Alternatively, the context may be used without the with statement
by manually invoking its begin() and end() methods.

Return an object which implements
pyramid.interfaces.IViewMapper. kw will be a dictionary
containing view-specific arguments, such as permission,
predicates, attr, renderer, and other items. An
IViewMapperFactory is used by
pyramid.config.Configurator.add_view() to provide a plugpoint
to extension developers who want to modify potential view callable
invocation signatures and response values.

Provided with an arbitrary object (a function, class, or
instance), returns a callable with the call signature (context,request). The callable returned should itself return a Response
object. An IViewMapper is returned by
pyramid.interfaces.IViewMapperFactory.

Return the existing value for key k in the dictionary. If no
value with k exists in the dictionary, set the default
value into the dictionary under the k name passed. If a value already
existed in the dictionary, return it. If a value did not exist in
the dictionary, return the default

An ordered dictionary that can have multiple values for each key. A
multidict adds the methods getall, getone, mixed, extend,
add, and dict_of_lists to the normal dictionary interface. A
multidict data structure is used as request.POST, request.GET,
and request.params within an Pyramid application.

Returns a dictionary where the values are either single values,
or a list of values when a key/value appears more than once in this
dictionary. This is similar to the kind of dictionary often used to
represent the variables in a web request.

Merge the cookies that were set on this response with the given
resp object (which can be any WSGI application). If the resp is a
webob.Response object, then the other object will be modified
in-place.

Get/set the Content-Type header (or None), without the charset
or any parameters. If you include parameters (or ; at all) when
setting the content_type, any existing parameters will be deleted;
otherwise they will be preserved.

An introspectable object used for configuration introspection. In
addition to the methods below, objects which implement this interface
must also implement all the methods of Python's
collections.MutableMapping (the "dictionary interface"), and must be
hashable.

Register this IIntrospectable with an introspector. This method
is invoked during action execution. Adds the introspectable and its
relations to the introspector. introspector should be an object
implementing IIntrospector. action_info should be a object
implementing the interface pyramid.interfaces.IActionInfo
representing the call that registered this introspectable.
Pseudocode for an implementation of this method:

Remove the IIntrospectable related to category_name and
discriminator from the introspector, and fix up any relations
that the introspectable participates in. This method will not raise
an error if an introspectable related to the category name and
discriminator does not exist.

Get a sequence of tuples in the form [(category_name,[{'introspectable':IIntrospectable,'related':[sequenceofrelatedIIntrospectables]},...])] representing all known
introspectables. If sort_key is None, each introspectables
sequence will be returned in the order the introspectables were added
to the introspector. Otherwise, sort_key should be a function that
accepts an IIntrospectable and returns a value from it (ala the
key function of Python's sorted callable).

Given any number of (category_name,discriminator) pairs
passed as positional arguments, relate the associated introspectables
to each other. The introspectable related to each pair must have
already been added via .add or .add_intr; a KeyError
will result if this is not true. An error will not be raised if any
pair has already been associated with another.

This method is not typically called directly, instead it's called
indirectly by pyramid.interfaces.IIntrospector.register()

Given any number of (category_name,discriminator) pairs
passed as positional arguments, unrelate the associated introspectables
from each other. The introspectable related to each pair must have
already been added via .add or .add_intr; a KeyError
will result if this is not true. An error will not be raised if any
pair is not already related to another.

This method is not typically called directly, instead it's called
indirectly by pyramid.interfaces.IIntrospector.register()

Add the IIntrospectable intr (use instead of
pyramid.interfaces.IIntrospector.add() when you have a custom
IIntrospectable). Replaces any existing introspectable registered
using the same category/discriminator.

This method is not typically called directly, instead it's called
indirectly by pyramid.interfaces.IIntrospector.register()

Get a sequence of dictionaries in the form
[{'introspectable':IIntrospectable,'related':[sequenceofrelatedIIntrospectables]},...] where each introspectable is part of the
category associated with category_name .

If the category named category_name does not exist in the
introspector the value passed as default will be returned.

If sort_key is None, the sequence will be returned in the
order the introspectables were added to the introspector. Otherwise,
sort_key should be a function that accepts an IIntrospectable and
returns a value from it (ala the key function of Python's
sorted callable).

Modifies a subpath and/or keyword arguments from which a static asset
URL will be computed during URL generation.

The subpath argument is a path of /-delimited segments that
represent the portion of the asset URL which is used to find the asset.
The kw argument is a dict of keywords that are to be passed
eventually to static_url() for URL
generation. The return value should be a two-tuple of
(subpath,kw) where subpath is the relative URL from where the
file is served and kw is the same input argument. The return value
should be modified to include the cache bust token in the generated
URL.

The kw dictionary contains extra arguments passed to
static_url() as well as some extra
items that may be usful including:

pathspec is the path specification for the resource
to be cache busted.

The pathspec and rawspec values are only different in cases
where an asset has been mounted into a virtual location using
pyramid.config.Configurator.override_asset(). For example, with
a call to request.static_url('myapp:static/foo.png'),the``pathspec is myapp:static/foo.png whereas the rawspec may
be themepkg:bar.png, assuming a call to
config.override_asset('myapp:static/foo.png','themepkg:bar.png').