From 2cce431f02a37c119eacfc3dfa94af9fe3305de1 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 18 Oct 2009 02:27:43 +0000 Subject: - More than one ``@bfg_view`` decorator may now be stacked on top of any number of others. Each invocation of the decorator registers a single view. For instance, the following combination of decorators and a function will register two views:: from repoze.bfg.view import bfg_view @bfg_view(name='edit') @bfg_view(name='change') def edit(context, request): pass This makes it possible to associate more than one view configuration for a single callable without requiring ZCML. --- docs/narr/views.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'docs') diff --git a/docs/narr/views.rst b/docs/narr/views.rst index 3979ec8f6..b52abf57f 100644 --- a/docs/narr/views.rst +++ b/docs/narr/views.rst @@ -708,6 +708,27 @@ decorator syntactic sugar), if you wish: my_view = bfg_view()(MyView) +More than one ``bfg_view`` decorator can be stacked on top of any +number of others. Each decorator creates a separate view +registration. For example: + +.. code-block:: python + :linenos: + + from repoze.bfg.view import bfg_view + + @bfg_view(name='edit') + @bfg_view(name='change') + def edit(context, request): + pass + +This registers the same view under two different names. + +.. note:: ``bfg_view`` decorator stacking is a feature new in + :mod:`repoze.bfg` 1.1. Previously, these decorators could not be + stacked without the effect of the "upper" decorator cancelling the + effect of the the decorator beneath it. + .. _view_lookup_ordering: View Lookup Ordering -- cgit v1.2.3