summaryrefslogtreecommitdiff
path: root/docs/whatsnew-1.5.rst
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2013-07-24 17:22:48 -0400
committerChris McDonough <chrism@plope.com>2013-07-24 17:22:48 -0400
commit32333e4d84fe0e71ce097a5dca57025353956dbe (patch)
treec9814e4b80b1b1c215156885559e2744eebf5c87 /docs/whatsnew-1.5.rst
parentd79c0338e6b87ffa657f91065ce73c752f60a0b8 (diff)
downloadpyramid-32333e4d84fe0e71ce097a5dca57025353956dbe.tar.gz
pyramid-32333e4d84fe0e71ce097a5dca57025353956dbe.tar.bz2
pyramid-32333e4d84fe0e71ce097a5dca57025353956dbe.zip
add not_ predicate feature
Diffstat (limited to 'docs/whatsnew-1.5.rst')
-rw-r--r--docs/whatsnew-1.5.rst26
1 files changed, 26 insertions, 0 deletions
diff --git a/docs/whatsnew-1.5.rst b/docs/whatsnew-1.5.rst
index 47b768eb9..ee2250017 100644
--- a/docs/whatsnew-1.5.rst
+++ b/docs/whatsnew-1.5.rst
@@ -12,6 +12,32 @@ Feature Additions
The feature additions in Pyramid 1.5 follow.
+- Add the ability to invert the result of any view, route, or subscriber
+ predicate value using the ``not_`` class. For example:
+
+ .. code-block:: python
+
+ from pyramid.config import not_
+
+ @view_config(route_name='myroute', request_method=not_('POST'))
+ def myview(request): ...
+
+ The above example will ensure that the view is called if the request method
+ is not POST, at least if no other view is more specific.
+
+ The :class:`pyramid.config.not_` class can be used against any value that is
+ a predicate value passed in any of these contexts:
+
+ - :meth:`pyramid.config.Configurator.add_view`
+
+ - :meth:`pyramid.config.Configurator.add_route`
+
+ - :meth:`pyramid.config.Configurator.add_subscriber`
+
+ - :meth:`pyramid.view.view_config`
+
+ - :meth:`pyramid.events.subscriber`
+
- View lookup will now search for valid views based on the inheritance
hierarchy of the context. It tries to find views based on the most specific
context first, and upon predicate failure, will move up the inheritance chain