'Add a :term:`view configuration` to the current
configuration state.  Arguments to ``add_view`` are broken
down below into *predicate* arguments and *non-predicate*
arguments.  Predicate arguments narrow the circumstances in
which the view callable will be invoked when a request is
presented to :app:`Pyramid`; non-predicate arguments are
informational.
Non-Predicate Arguments
view
A :term:`view callable` or a :term:`dotted Python name`
which refers to a view callable.  This argument is required
unless a ``renderer`` argument also exists.  If a
``renderer`` argument is passed, and a ``view`` argument is
not provided, the view callable defaults to a callable that
returns an empty dictionary (see
:ref:`views_which_use_a_renderer`).
permission
A :term:`permission` that the user must possess in order to invoke
the :term:`view callable`.  See :ref:`view_security_section` for
more information about view security and permissions.  This is
often a string like ``view`` or ``edit``.
If ``permission`` is omitted, a *default* permission may be used
for this view registration if one was named as the
:class:`pyramid.config.Configurator` constructor\'s
``default_permission`` argument, or if
:meth:`pyramid.config.Configurator.set_default_permission` was used
prior to this view registration.  Pass the value
:data:`pyramid.security.NO_PERMISSION_REQUIRED` as the permission
argument to explicitly indicate 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.
attr
This knob is most useful when the view definition is a class.
The view machinery defaults to using the ``__call__`` method
of the :term:`view callable` (or the function itself, if the
view callable is a function) to obtain a response.  The
``attr`` value allows you to vary the method attribute used
to obtain the response.  For example, if your view was a
class, and the class has a method named ``index`` and you
wanted to use this method instead of the class\' ``__call__``
method to return the response, you\'d say ``attr="index"`` in the
view configuration for the view.
renderer
This is either a single string term (e.g. ``json``) or a
string implying a path or :term:`asset specification`
(e.g. ``templates/views.pt``) naming a :term:`renderer`
implementation.  If the ``renderer`` value does not contain
a dot ``.``, the specified string will be used to look up a
renderer implementation, and that renderer implementation
will be used to construct a response from the view return
value.  If the ``renderer`` value contains a dot (``.``),
the specified term will be treated as a path, and the
filename extension of the last element in the path will be
used to look up the renderer implementation, which will be
passed the full path.  The renderer implementation will be
used to construct a :term:`response` from the view return
value.
Note that if the view itself returns a :term:`response` (see
:ref:`the_response`), the specified renderer implementation
is never called.
When the renderer is a path, although a path is usually just
a simple relative pathname (e.g. ``templates/foo.pt``,
implying that a template named "foo.pt" is in the
"templates" directory relative to the directory of the
current :term:`package` of the Configurator), a path can be
absolute, starting with a slash on UNIX or a drive letter
prefix on Windows.  The path can alternately be a
:term:`asset specification` in the form
``some.dotted.package_name:relative/path``, making it
possible to address template assets which live in a
separate package.
The ``renderer`` attribute is optional.  If it is not
defined, the "null" renderer is assumed (no rendering is
performed and the value is passed back to the upstream
:app:`Pyramid` machinery unmodified).
http_cache
.. versionadded:: 1.1
When you supply an ``http_cache`` value to a view configuration,
the ``Expires`` and ``Cache-Control`` headers of a response
generated by the associated view callable are modified.  The value
for ``http_cache`` may be one of the following:
- A nonzero integer.  If it\'s a nonzero integer, it\'s treated as a
number of seconds.  This number of seconds will be used to
compute the ``Expires`` header and the ``Cache-Control:
max-age`` parameter of responses to requests which call this view.
For example: ``http_cache=3600`` instructs the requesting browser
to \'cache this response for an hour, please\'.
- A ``datetime.timedelta`` instance.  If it\'s a
``datetime.timedelta`` instance, it will be converted into a
number of seconds, and that number of seconds will be used to
compute the ``Expires`` header and the ``Cache-Control:
max-age`` parameter of responses to requests which call this view.
For example: ``http_cache=datetime.timedelta(days=1)`` instructs
the requesting browser to \'cache this response for a day, please\'.
- Zero (``0``).  If the value is zero, the ``Cache-Control`` and
``Expires`` headers present in all responses from this view will
be composed such that client browser cache (and any intermediate
caches) are instructed to never cache the response.
- A two-tuple.  If it\'s a two tuple (e.g. ``http_cache=(1,
{\'public\':True})``), the first value in the tuple may be a
nonzero integer or a ``datetime.timedelta`` instance; in either
case this value will be used as the number of seconds to cache
the response.  The second value in the tuple must be a
dictionary.  The values present in the dictionary will be used as
input to the ``Cache-Control`` response header.  For example:
``http_cache=(3600, {\'public\':True})`` means \'cache for an hour,
and add ``public`` to the Cache-Control header of the response\'.
All keys and values supported by the
``webob.cachecontrol.CacheControl`` interface may be added to the
dictionary.  Supplying ``{\'public\':True}`` is equivalent to
calling ``response.cache_control.public = True``.
Providing a non-tuple value as ``http_cache`` is equivalent to
calling ``response.cache_expires(value)`` within your view\'s body.
Providing a two-tuple value as ``http_cache`` is equivalent to
calling ``response.cache_expires(value[0], **value[1])`` within your
view\'s body.
If you wish to avoid influencing, the ``Expires`` header, and
instead wish to only influence ``Cache-Control`` headers, pass a
tuple as ``http_cache`` with the first element of ``None``, e.g.:
``(None, {\'public\':True})``.
If you wish to prevent a view that uses ``http_cache`` in its
configuration from having its caching response headers changed by
this machinery, set ``response.cache_control.prevent_auto = True``
before returning the response from the view.  This effectively
disables any HTTP caching done by ``http_cache`` for that response.
require_csrf
.. versionadded:: 1.7
A boolean option or ``None``. Default: ``None``.
If this option is set to ``True`` then CSRF checks will be enabled
for requests to this view. The required token or header default to
``csrf_token`` and ``X-CSRF-Token``, respectively.
CSRF checks only affect "unsafe" methods as defined by RFC2616. By
default, these methods are anything except
``GET``, ``HEAD``, ``OPTIONS``, and ``TRACE``.
The defaults here may be overridden by
:meth:`pyramid.config.Configurator.set_default_csrf_options`.
This feature requires a configured :term:`session factory`.
If this option is set to ``False`` then CSRF checks will be disabled
regardless of the default ``require_csrf`` setting passed
to ``set_default_csrf_options``.
See :ref:`auto_csrf_checking` for more information.
wrapper
The :term:`view name` of a different :term:`view
configuration` which will receive the response body of this
view as the ``request.wrapped_body`` attribute of its own
:term:`request`, and the :term:`response` returned by this
view as the ``request.wrapped_response`` attribute of its
own request.  Using a wrapper makes it possible to "chain"
views together to form a composite response.  The response
of the outermost wrapper view will be returned to the user.
The wrapper view will be found as any view is found: see
:ref:`view_lookup`.  The "best" wrapper view will be found
based on the lookup ordering: "under the hood" this wrapper
view is looked up via
``pyramid.view.render_view_to_response(context, request,
\'wrapper_viewname\')``. The context and request of a wrapper
view is the same context and request of the inner view.  If
this attribute is unspecified, no view wrapping is done.
decorator
A :term:`dotted Python name` to function (or the function itself,
or an iterable of the aforementioned) which will be used to
decorate the registered :term:`view callable`.  The decorator
function(s) will be called with the view callable as a single
argument.  The view callable it is passed will accept
``(context, request)``.  The decorator(s) must return a
replacement view callable which also accepts ``(context,
request)``.
If decorator is an iterable, the callables will be combined and
used in the order provided as a decorator.
For example::
@view_config(...,
decorator=(decorator2,
decorator1))
def myview(request):
Is similar to doing::
@view_config(...)
@decorator2
@decorator1
def myview(request):
Except with the existing benefits of ``decorator=`` (having a common
decorator syntax for all view calling conventions and not having to
think about preserving function attributes such as ``__name__`` and
``__module__`` within decorator logic).
An important distinction is that each decorator will receive a
response object implementing :class:`pyramid.interfaces.IResponse`
instead of the raw value returned from the view callable. All
decorators in the chain must return a response object or raise an
exception:
.. code-block:: python
def log_timer(wrapped):
def wrapper(context, request):
start = time.time()
response = wrapped(context, request)
duration = time.time() - start
response.headers[\'X-View-Time\'] = \'%.3f\' % (duration,)
log.info(\'view took %.3f seconds\', duration)
return response
return wrapper
.. versionchanged:: 1.4a4
Passing an iterable.
mapper
A Python object or :term:`dotted Python name` which refers to a
:term:`view mapper`, or ``None``.  By default it is ``None``, which
indicates that the view should use the default view mapper.  This
plug-point is useful for Pyramid extension developers, but it\'s not
very useful for \'civilians\' who are just developing stock Pyramid
applications. Pay no attention to the man behind the curtain.
accept
This value represents a match query for one or more mimetypes in the
``Accept`` HTTP request header.  If this value is specified, it must
be in one of the following forms: a mimetype match token in the form
``text/plain``, a wildcard mimetype match token in the form
``text/*`` or a match-all wildcard mimetype match token in the form
``*/*``.  If any of the forms matches the ``Accept`` header of the
request, or if the ``Accept`` header isn\'t set at all in the request,
this will match the current view. If this does not match the
``Accept`` header of the request, view matching continues.
Predicate Arguments
name
The :term:`view name`.  Read :ref:`traversal_chapter` to
understand the concept of a view name.
context
An object or a :term:`dotted Python name` referring to an
interface or class object that the :term:`context` must be
an instance of, *or* the :term:`interface` that the
:term:`context` must provide in order for this view to be
found and called.  This predicate is true when the
:term:`context` is an instance of the represented class or
if the :term:`context` provides the represented interface;
it is otherwise false.  This argument may also be provided
to ``add_view`` as ``for_`` (an older, still-supported
spelling). If the view should *only* match when handling
exceptions, then set the ``exception_only`` to ``True``.
exception_only
.. versionadded:: 1.8
When this value is ``True``, the ``context`` argument must be
a subclass of ``Exception``. This flag indicates that only an
:term:`exception view` should be created, and that this view should
not match if the traversal :term:`context` matches the ``context``
argument. If the ``context`` is a subclass of ``Exception`` and
this value is ``False`` (the default), then a view will be
registered to match the traversal :term:`context` as well.
route_name
This value must match the ``name`` of a :term:`route
configuration` declaration (see :ref:`urldispatch_chapter`)
that must match before this view will be called.
request_type
This value should be an :term:`interface` that the
:term:`request` must provide in order for this view to be
found and called.  This value exists only for backwards
compatibility purposes.
request_method
This value can be either a string (such as ``"GET"``, ``"POST"``,
``"PUT"``, ``"DELETE"``, ``"HEAD"`` or ``"OPTIONS"``) representing
an HTTP ``REQUEST_METHOD``, or a tuple containing one or more of
these strings.  A view declaration with this argument ensures that
the view will only be called when the ``method`` attribute of the
request (aka the ``REQUEST_METHOD`` of the WSGI environment) matches
a supplied value.  Note that use of ``GET`` also implies that the
view will respond to ``HEAD`` as of Pyramid 1.4.
.. versionchanged:: 1.2
The ability to pass a tuple of items as ``request_method``.
Previous versions allowed only a string.
request_param
This value can be any string or any sequence of strings.  A view
declaration with this argument ensures that the view will only be
called when the :term:`request` has a key in the ``request.params``
dictionary (an HTTP ``GET`` or ``POST`` variable) that has a
name which matches the supplied value (if the value is a string)
or values (if the value is a tuple).  If any value
supplied has a ``=`` sign in it,
e.g. ``request_param="foo=123"``, then the key (``foo``)
must both exist in the ``request.params`` dictionary, *and*
the value must match the right hand side of the expression
(``123``) for the view to "match" the current request.
match_param
.. versionadded:: 1.2
This value can be a string of the format "key=value" or a tuple
containing one or more of these strings.
A view declaration with this argument ensures that the view will
only be called when the :term:`request` has key/value pairs in its
:term:`matchdict` that equal those supplied in the predicate.
e.g. ``match_param="action=edit"`` would require the ``action``
parameter in the :term:`matchdict` match the right hand side of
the expression (``edit``) for the view to "match" the current
request.
If the ``match_param`` is a tuple, every key/value pair must match
for the predicate to pass.
containment
This value should be a Python class or :term:`interface` (or a
:term:`dotted Python name`) that an object in the
:term:`lineage` of the context must provide in order for this view
to be found and called.  The nodes in your object graph must be
"location-aware" to use this feature.  See
:ref:`location_aware` for more information about
location-awareness.
xhr
This value should be either ``True`` or ``False``.  If this
value is specified and is ``True``, the :term:`request`
must possess an ``HTTP_X_REQUESTED_WITH`` (aka
``X-Requested-With``) header that has the value
``XMLHttpRequest`` for this view to be found and called.
This is useful for detecting AJAX requests issued from
jQuery, Prototype and other Javascript libraries.
header
This value represents an HTTP header name or a header
name/value pair.  If the value contains a ``:`` (colon), it
will be considered a name/value pair
(e.g. ``User-Agent:Mozilla/.*`` or ``Host:localhost``).  The
value portion should be a regular expression.  If the value
does not contain a colon, the entire value will be
considered to be the header name
(e.g. ``If-Modified-Since``).  If the value evaluates to a
header name only without a value, the header specified by
the name must be present in the request for this predicate
to be true.  If the value evaluates to a header name/value
pair, the header specified by the name must be present in
the request *and* the regular expression specified as the
value must match the header value.  Whether or not the value
represents a header name or a header name/value pair, the
case of the header name is not significant.
path_info
This value represents a regular expression pattern that will
be tested against the ``PATH_INFO`` WSGI environment
variable.  If the regex matches, this predicate will be
``True``.
check_csrf
.. deprecated:: 1.7
Use the ``require_csrf`` option or see :ref:`auto_csrf_checking`
instead to have :class:`pyramid.exceptions.BadCSRFToken`
exceptions raised.
If specified, this value should be one of ``None``, ``True``,
``False``, or a string representing the \'check name\'.  If the value
is ``True`` or a string, CSRF checking will be performed.  If the
value is ``False`` or ``None``, CSRF checking will not be performed.
If the value provided is a string, that string will be used as the
\'check name\'.  If the value provided is ``True``, ``csrf_token`` will
be used as the check name.
If CSRF checking is performed, the checked value will be the value of
``request.params[check_name]``. This value will be compared against
the value of ``policy.get_csrf_token()`` (where ``policy`` is an
implementation of :meth:`pyramid.interfaces.ICSRFStoragePolicy`), and the
check will pass if these two values are the same. If the check
passes, the associated view will be permitted to execute. If the
check fails, the associated view will not be permitted to execute.
.. versionadded:: 1.4a2
.. versionchanged:: 1.9
This feature requires either a :term:`session factory` to have been
configured, or a :term:`CSRF storage policy` other than the default
to be in use.
physical_path
If specified, this value should be a string or a tuple representing
the :term:`physical path` of the context found via traversal for this
predicate to match as true.  For example: ``physical_path=\'/\'`` or
``physical_path=\'/a/b/c\'`` or ``physical_path=(\'\', \'a\', \'b\', \'c\')``.
This is not a path prefix match or a regex, it\'s a whole-path match.
It\'s useful when you want to always potentially show a view when some
object is traversed to, but you can\'t be sure about what kind of
object it will be, so you can\'t use the ``context`` predicate.  The
individual path elements inbetween slash characters or in tuple
elements should be the Unicode representation of the name of the
resource and should not be encoded in any way.
.. versionadded:: 1.4a3
effective_principals
If specified, this value should be a :term:`principal` identifier or
a sequence of principal identifiers.  If the
:attr:`pyramid.request.Request.effective_principals` property
indicates that every principal named in the argument list is present
in the current request, this predicate will return True; otherwise it
will return False.  For example:
``effective_principals=pyramid.security.Authenticated`` or
``effective_principals=(\'fred\', \'group:admins\')``.
.. versionadded:: 1.4a4
custom_predicates
.. deprecated:: 1.5
This value should be a sequence of references to custom
predicate callables.  Use custom predicates when no set of
predefined predicates do what you need.  Custom predicates
can be combined with predefined predicates as necessary.
Each custom predicate callable should accept two arguments:
``context`` and ``request`` and should return either
``True`` or ``False`` after doing arbitrary evaluation of
the context and/or the request.  The ``predicates`` argument
to this method and the ability to register third-party view
predicates via
:meth:`pyramid.config.Configurator.add_view_predicate`
obsoletes this argument, but it is kept around for backwards
compatibility.
view_options
Pass a key/value pair here to use a third-party predicate or set a
value for a view deriver. See
:meth:`pyramid.config.Configurator.add_view_predicate` and
:meth:`pyramid.config.Configurator.add_view_deriver`. See
:ref:`view_and_route_predicates` for more information about
third-party predicates and :ref:`view_derivers` for information
about view derivers.
.. versionadded: 1.4a1
.. versionchanged: 1.7
Support setting view deriver options. Previously, only custom
view predicate values could be supplied.'

@viewdefaults
@action_method
def add_view(self, view=None, name='', for_=None, permission=None, request_type=None, route_name=None, request_method=None, request_param=None, containment=None, attr=None, renderer=None, wrapper=None, xhr=None, accept=None, header=None, path_info=None, custom_predicates=(), context=None, decorator=None, mapper=None, http_cache=None, match_param=None, check_csrf=None, require_csrf=None, exception_only=False, **view_options):

    if custom_predicates:
        warnings.warn('The    "custom_predicates"    argument    to    Configurator.add_view    is    deprecated    as    of    Pyramid    1.5.        Use    "config.add_view_predicate"    and    use    the    registered    view    predicate    as    a    predicate    argument    to    add_view    instead.    See    "Adding    A    Third    Party    View,    Route,    or    Subscriber    Predicate"    in    the    "Hooks"    chapter    of    the    documentation    for    more    information.', DeprecationWarning, stacklevel=4)
    if (check_csrf is not None):
        warnings.warn('The    "check_csrf"    argument    to    Configurator.add_view    is    deprecated    as    of    Pyramid    1.7.    Use    the    "require_csrf"    option    instead    or    see    "Checking    CSRF    Tokens    Automatically"    in    the    "Sessions"    chapter    of    the    documentation    for    more    information.', DeprecationWarning, stacklevel=4)
    view = self.maybe_dotted(view)
    context = self.maybe_dotted(context)
    for_ = self.maybe_dotted(for_)
    containment = self.maybe_dotted(containment)
    mapper = self.maybe_dotted(mapper)
    def combine(*decorators):
        def decorated(view_callable):
            for decorator in reversed(decorators):
                view_callable = decorator(view_callable)
            return view_callable
        return decorated
    if is_nonstr_iter(decorator):
        decorator = combine(*map(self.maybe_dotted, decorator))
    else:
        decorator = self.maybe_dotted(decorator)
    if (not view):
        if renderer:
            def view(context, request):
                return {}
        else:
            raise ConfigurationError('"view"    was    not    specified    and    no    "renderer"    specified')
    if (request_type is not None):
        request_type = self.maybe_dotted(request_type)
        if (not IInterface.providedBy(request_type)):
            raise ConfigurationError(('request_type    must    be    an    interface,    not    %s' % request_type))
    if (context is None):
        context = for_
    isexc = isexception(context)
    if (exception_only and (not isexc)):
        raise ConfigurationError('view    "context"    must    be    an    exception    type    when    "exception_only"    is    True')
    r_context = context
    if (r_context is None):
        r_context = Interface
    if (not IInterface.providedBy(r_context)):
        r_context = implementedBy(r_context)
    if isinstance(renderer, string_types):
        renderer = renderers.RendererHelper(name=renderer, package=self.package, registry=self.registry)
    if (accept is not None):
        accept = accept.lower()
    introspectables = []
    ovals = view_options.copy()
    ovals.update(dict(xhr=xhr, request_method=request_method, path_info=path_info, request_param=request_param, header=header, accept=accept, containment=containment, request_type=request_type, match_param=match_param, check_csrf=check_csrf, custom=predvalseq(custom_predicates)))
    def discrim_func():
        predlist = self.get_predlist('view')
        valid_predicates = predlist.names()
        pvals = {}
        dvals = {}
        for (k, v) in ovals.items():
            if (k in valid_predicates):
                pvals[k] = v
            else:
                dvals[k] = v
        self._check_view_options(**dvals)
        (order, preds, phash) = predlist.make(self, **pvals)
        view_intr.update({'phash': phash, 'order': order, 'predicates': preds})
        return ('view', context, name, route_name, phash)
    discriminator = Deferred(discrim_func)
    if (inspect.isclass(view) and attr):
        view_desc = ('method    %r    of    %s' % (attr, self.object_description(view)))
    else:
        view_desc = self.object_description(view)
    tmpl_intr = None
    view_intr = self.introspectable('views', discriminator, view_desc, 'view')
    view_intr.update(dict(name=name, context=context, exception_only=exception_only, containment=containment, request_param=request_param, request_methods=request_method, route_name=route_name, attr=attr, xhr=xhr, accept=accept, header=header, path_info=path_info, match_param=match_param, check_csrf=check_csrf, http_cache=http_cache, require_csrf=require_csrf, callable=view, mapper=mapper, decorator=decorator))
    view_intr.update(view_options)
    introspectables.append(view_intr)
    def register(permission=permission, renderer=renderer):
        request_iface = IRequest
        if (route_name is not None):
            request_iface = self.registry.queryUtility(IRouteRequest, name=route_name)
            if (request_iface is None):
                raise ConfigurationError(('No    route    named    %s    found    for    view    registration' % route_name))
        if (renderer is None):
            if (self.registry.queryUtility(IRendererFactory) is not None):
                renderer = renderers.RendererHelper(name=None, package=self.package, registry=self.registry)
        renderer_type = getattr(renderer, 'type', None)
        intrspc = self.introspector
        if ((renderer_type is not None) and (tmpl_intr is not None) and (intrspc is not None) and (intrspc.get('renderer    factories', renderer_type) is not None)):
            tmpl_intr.relate('renderer    factories', renderer.type)
        if (not exception_only):
            derived_view = derive_view(False, renderer)
            register_view(IViewClassifier, request_iface, derived_view)
        if isexc:
            derived_exc_view = derive_view(True, renderer)
            register_view(IExceptionViewClassifier, request_iface, derived_exc_view)
            if exception_only:
                derived_view = derived_exc_view
        if ((not exception_only) and isexc):
            derived_view = runtime_exc_view(derived_view, derived_exc_view)
        derived_view.__discriminator__ = (lambda *arg: discriminator)
        view_intr['derived_callable'] = derived_view
        self.registry._clear_view_lookup_cache()
    def derive_view(isexc_only, renderer):
        preds = view_intr['predicates']
        order = view_intr['order']
        phash = view_intr['phash']
        derived_view = self._derive_view(view, route_name=route_name, permission=permission, predicates=preds, attr=attr, context=context, exception_only=isexc_only, renderer=renderer, wrapper_viewname=wrapper, viewname=name, accept=accept, order=order, phash=phash, decorator=decorator, mapper=mapper, http_cache=http_cache, require_csrf=require_csrf, extra_options=ovals)
        return derived_view
    def register_view(classifier, request_iface, derived_view):
        old_view = None
        (order, phash) = (view_intr['order'], view_intr['phash'])
        registered = self.registry.adapters.registered
        for view_type in (IView, ISecuredView, IMultiView):
            old_view = registered((classifier, request_iface, r_context), view_type, name)
            if (old_view is not None):
                break
        def regclosure():
            if hasattr(derived_view, '__call_permissive__'):
                view_iface = ISecuredView
            else:
                view_iface = IView
            self.registry.registerAdapter(derived_view, (classifier, request_iface, context), view_iface, name)
        is_multiview = IMultiView.providedBy(old_view)
        old_phash = getattr(old_view, '__phash__', DEFAULT_PHASH)
        if (old_view is None):
            regclosure()
        elif ((not is_multiview) and (old_phash == phash)):
            regclosure()
        else:
            if is_multiview:
                multiview = old_view
            else:
                multiview = MultiView(name)
                old_accept = getattr(old_view, '__accept__', None)
                old_order = getattr(old_view, '__order__', MAX_ORDER)
                multiview.add(old_view, old_order, old_accept, old_phash)
            multiview.add(derived_view, order, accept, phash)
            for view_type in (IView, ISecuredView):
                self.registry.adapters.unregister((classifier, request_iface, r_context), view_type, name=name)
            self.registry.registerAdapter(multiview, (classifier, request_iface, context), IMultiView, name=name)
    if mapper:
        mapper_intr = self.introspectable('view    mappers', discriminator, ('view    mapper    for    %s' % view_desc), 'view    mapper')
        mapper_intr['mapper'] = mapper
        mapper_intr.relate('views', discriminator)
        introspectables.append(mapper_intr)
    if route_name:
        view_intr.relate('routes', route_name)
    if ((renderer is not None) and renderer.name and ('.' in renderer.name)):
        tmpl_intr = self.introspectable('templates', discriminator, renderer.name, 'template')
        tmpl_intr.relate('views', discriminator)
        tmpl_intr['name'] = renderer.name
        tmpl_intr['type'] = renderer.type
        tmpl_intr['renderer'] = renderer
        introspectables.append(tmpl_intr)
    if (permission is not None):
        perm_intr = self.introspectable('permissions', permission, permission, 'permission')
        perm_intr['value'] = permission
        perm_intr.relate('views', discriminator)
        introspectables.append(perm_intr)
    self.action(discriminator, register, introspectables=introspectables)
