From 208ee5a8d6409bcdce361009dee6a2e335de1679 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 15 Jul 2010 17:41:05 +0000 Subject: Features -------- - New view predicate: match_val. The ``match_val`` value represents the presence of a value in the structure added to the request named ``matchdict`` during URL dispatch representing the match values from the route pattern (e.g. if the route pattern has ``:foo`` in it, and the route matches, a key will exist in the matchdict named ``foo``). Like all other view predicates, this feature is exposed via the ``bfg_view`` API, the Configurator ``add_view`` API, and the ZCML ``view`` directive. Documentation ------------- - API documentation for the ``add_view`` method of the configurator changed to include ``match_val``. - ZCML documentation for ``view`` ZCML directive changed to include ``match_val``. - The ``Views`` narrative chapter now contains a description of the ``match_val`` predicate. Bug Fixes --------- - The ``header`` predicate (when used as either a view predicate or a route predicate) had a problem when specified with a name/regex pair. When the header did not exist in the headers dictionary, the regex match could be fed ``None``, causing it to throw a ``TypeError: expected string or buffer`` exception. Now, the predicate returns False as intended. Internal -------- - Remove ``repoze.bfg.configuration.isclass`` function in favor of using ``inspect.isclass``. --- docs/zcml/view.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'docs/zcml') diff --git a/docs/zcml/view.rst b/docs/zcml/view.rst index d33a9a9a5..9fe63738b 100644 --- a/docs/zcml/view.rst +++ b/docs/zcml/view.rst @@ -224,6 +224,30 @@ Predicate Attributes .. note:: This feature is new as of :mod:`repoze.bfg` 1.1. +``match_val`` + + The ``match_val`` value represents the presence of a value in the + :term:`URL dispatch` structure added to the request named + ``matchdict``. ``matchdict`` represents the match values from the + route pattern (e.g. if the route pattern has ``:foo`` in it, and the + route matches, a key will exist in the matchdict named ``foo``). If + the value does not contain a colon, the entire value will be + considered to be the name of a matchdict key (e.g. ``action``). If + the value does contain a ``:`` (colon), it will be considered a + name/value pair (e.g. ``action:generate.html`` or + ``action:\w+.html``). The right hand side following the colon + should be a regular expression. + + If the value does not contain a colon, the key specified by the name + must be present in the URL dispatch matchdict for this predicate to + be true; the value of the key is ignored. If the value does contain + a colon, the name implied by the right hand must be present in the + matchdict *and* the regular expression specified on the right hand + side of the colon must match the value for the name in the matchdict + for this predicate to be true. + + .. note:: This feature is new as of :mod:`repoze.bfg` 1.3. + ``custom_predicates`` This value should be a sequence of references to custom predicate callables (e.g. ``dotted.name.one dotted.name.two``, if used in -- cgit v1.2.3