diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-10-14 11:14:44 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-10-14 11:14:44 +0000 |
| commit | 083422c0c66c1aa53f9d96c6fd185e238bc51708 (patch) | |
| tree | dfed56fdd9d595e1d081370791eeb3a30b307904 /docs/narr/urldispatch.rst | |
| parent | 069db05dec4d8352d37cf05cf3c6ffd04b69fc91 (diff) | |
| download | pyramid-083422c0c66c1aa53f9d96c6fd185e238bc51708.tar.gz pyramid-083422c0c66c1aa53f9d96c6fd185e238bc51708.tar.bz2 pyramid-083422c0c66c1aa53f9d96c6fd185e238bc51708.zip | |
- Add ``xhr``, ``accept``, and ``header`` view configuration
predicates to ZCML view declaration, ZCML route declaration, and
``bfg_view`` decorator. See the ``Views`` narrative documentation
chapter for more information about these predicates.
Diffstat (limited to 'docs/narr/urldispatch.rst')
| -rw-r--r-- | docs/narr/urldispatch.rst | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/docs/narr/urldispatch.rst b/docs/narr/urldispatch.rst index a43d5e125..7a2a184f7 100644 --- a/docs/narr/urldispatch.rst +++ b/docs/narr/urldispatch.rst @@ -215,6 +215,56 @@ view_renderer .. note:: This feature is new as of :mod:`repoze.bfg` 1.1. +view_xhr + + Thie 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 for this + view to be found and called. This is useful for detecting AJAX + requests issued from jQuery, Prototype and other Javascript + libraries. + + This attribute can also be spelled as ``xhr``. + + .. note:: This feature is new as of :mod:`repoze.bfg` 1.1. + +view_accept + + The value of this attribute 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, this predicate will be true. + + This attribute can also be spelled as ``accept``. + + .. note:: This feature is new as of :mod:`repoze.bfg` 1.1. + +view_header + + The value of this attribute 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* of an attribute that represent + a name/value pair 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. + + This attribute can also be spelled as ``header``. + + .. note:: This feature is new as of :mod:`repoze.bfg` 1.1. + + The Matchdict ------------- |
