summaryrefslogtreecommitdiff
path: root/repoze/bfg/view.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2010-01-03 03:39:30 +0000
committerChris McDonough <chrism@agendaless.com>2010-01-03 03:39:30 +0000
commiteecdbc34962b00e35d41039af014462cf558acee (patch)
tree784bfdf054d6f4846fb1817d1ba7b01792792dcc /repoze/bfg/view.py
parent1dff935445ff293a7434f074c1f6bb7304174ec2 (diff)
downloadpyramid-eecdbc34962b00e35d41039af014462cf558acee.tar.gz
pyramid-eecdbc34962b00e35d41039af014462cf558acee.tar.bz2
pyramid-eecdbc34962b00e35d41039af014462cf558acee.zip
Features
-------- - The ``Configurator.add_view`` method now accepts an argument named ``context``. This is an alias for the older argument named ``for_``; it is preferred over ``for_``, but ``for_`` will continue to be supported "forever". - The ``view`` ZCML directive now accepts an attribute named ``context``. This is an alias for the older attribute named ``for``; it is preferred over ``for``, but ``for`` will continue to be supported "forever". - The ``Configurator.add_route`` method now accepts an argument named ``view_context``. This is an alias for the older argument named ``view_for``; it is preferred over ``view_for``, but ``view_for`` will continue to be supported "forever". - The ``route`` ZCML directive now accepts an attribute named ``view_context``. This is an alias for the older attribute named ``view_for``; it is preferred over ``view_for``, but ``view_for`` will continue to be supported "forever". Documentation and Paster Templates ---------------------------------- - All uses of the ``Configurator.add_view`` method that used its ``for_`` argument now use the ``context``argument instead. - All uses of the ``Configurator.add_route`` method that used its ``view_for`` argument now use the ``view_context``argument instead. - All uses of the ``view`` ZCML directive that used its ``for`` attribute now use the ``context`` attribute instead. - All uses of the ``route`` ZCML directive that used its ``view_for`` attribute now use the ``view_context`` attribute instead.
Diffstat (limited to 'repoze/bfg/view.py')
-rw-r--r--repoze/bfg/view.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/repoze/bfg/view.py b/repoze/bfg/view.py
index 8a33e246d..af3acb8b6 100644
--- a/repoze/bfg/view.py
+++ b/repoze/bfg/view.py
@@ -233,7 +233,7 @@ class bfg_view(object):
from models import MyModel
- @bfg_view(name='my_view', for_=MyModel, permission='read',
+ @bfg_view(name='my_view', context=MyModel, permission='read',
route_name='site1')
def my_view(context, request):
return 'OK'
@@ -243,7 +243,7 @@ class bfg_view(object):
import views
import models
- config.add_view(views.my_view, for_=models.MyModel, name='my_view',
+ config.add_view(views.my_view, context=models.MyModel, name='my_view',
permission='read', 'route_name='site1')
Or might replace the following ZCML ``view`` declaration::
@@ -257,13 +257,14 @@ class bfg_view(object):
/>
The following arguments are supported as arguments to
- ``bfg_view``: ``for_``, ``permission``, ``name``,
+ ``bfg_view``: ``context``, ``permission``, ``name``,
``request_type``, ``route_name``, ``request_method``,
``request_param``, ``containment``, ``xhr``, ``accept``,
``header`` and ``path_info``.
- If ``for_`` is not supplied, the interface
- ``zope.interface.Interface`` (matching any context) is used.
+ If ``context`` is not supplied, the interface
+ ``zope.interface.Interface`` (matching any context) is used. An alias
+ for ``context`` is ``for_``.
If ``permission`` is not supplied, no permission is registered for
this view (it's accessible by any caller).
@@ -456,10 +457,10 @@ class bfg_view(object):
route_name=None, request_method=None, request_param=None,
containment=None, attr=None, renderer=None, wrapper=None,
xhr=False, accept=None, header=None, path_info=None,
- custom_predicates=()):
+ custom_predicates=(), context=None):
self.name = name
self.request_type = request_type
- self.for_ = for_
+ self.context = context or for_
self.permission = permission
self.route_name = route_name
self.request_method = request_method