Permalink
Browse files

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.
  • Loading branch information...
1 parent 1dff935 commit eecdbc34962b00e35d41039af014462cf558acee Chris McDonough committed Jan 3, 2010
View
@@ -1,6 +1,44 @@
Next release
============
+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.
+
Documentation Licensing
-----------------------
View
@@ -7,6 +7,3 @@
- Get rid of ITraverser hook in favor of IViewLookup.
-- Add "context" as an alias for "for" in ZCML and imperative config
- bits.
-
View
@@ -655,9 +655,9 @@ administrative interface), you can register a route like ``<route
name="manage" path="manage/*traverse"/>`` and then associate
"management" views in your code by using the ``route_name`` argument
to a ``view`` configuration, e.g. ``<view view=".some.callable"
-for=".some.Model" route_name="manage"/>``. If you wire things up this
-way someone then walks up to for example, ``/manage/ob1/ob2``, they
-might be presented with a management interface, but walking up to
+context=".some.Model" route_name="manage"/>``. If you wire things up
+this way someone then walks up to for example, ``/manage/ob1/ob2``,
+they might be presented with a management interface, but walking up to
``/ob1/ob2`` would present them with the default object view. There
are other tricks you can pull in these hybrid configurations if you're
clever (and maybe masochistic) too.
View
@@ -409,16 +409,16 @@ Glossary
internally by :mod:`repoze.bfg` to perform view lookups and other
policy lookups. The ability to make use of an interface is
exposed to an application programmers during :term:`view
- configuration` via the ``for`` argument, the ``request_type``
+ configuration` via the ``context`` argument, the ``request_type``
argument and the ``containment`` argument. Interfaces are also
exposed to application developers when they make use of the
- :term:`event` system. Fundamentally, :mod:`repoze.bfg` programmers
- can think of an interface as something that they can attach to an
- object that stamps it with a "type" unrelated to its underlying
- Python type. Interfaces can also be used to describe the behavior
- of an object (its methods and attributes), but unless they choose
- to, :mod:`repoze.bfg` programmers do not need to understand or use
- this feature of interfaces.
+ :term:`event` system. Fundamentally, :mod:`repoze.bfg`
+ programmers can think of an interface as something that they can
+ attach to an object that stamps it with a "type" unrelated to its
+ underlying Python type. Interfaces can also be used to describe
+ the behavior of an object (its methods and attributes), but
+ unless they choose to, :mod:`repoze.bfg` programmers do not need
+ to understand or use this feature of interfaces.
event
An object broadcast to zero or more :term:`subscriber` callables
@@ -3,7 +3,7 @@
<include package="repoze.bfg.includes" />
<view
- for=".models.MyModel"
+ context=".models.MyModel"
view=".views.my_view"
renderer="templates/mytemplate.pt"
/>
View
@@ -181,7 +181,7 @@ Overriding Views
~~~~~~~~~~~~~~~~~
The ZCML ``<view>`` declarations you make which *override* application
-behavior will usually have the same ``for`` and ``name`` (and
+behavior will usually have the same ``context`` and ``name`` (and
:term:`predicate` attributes, if used) as the original. These
``<view>`` declarations will point at "new" view code. The new view
code itself will usually be cut-n-paste copies of view callables from
@@ -190,7 +190,7 @@ the original application with slight tweaks. For example:
.. code-block:: xml
:linenos:
- <view for="theoriginalapplication.models.SomeModel"
+ <view context="theoriginalapplication.models.SomeModel"
name="theview"
view=".views.a_view_that_does_something_slightly_different"
/>
View
@@ -225,11 +225,11 @@ a class that implements the following interface:
More than one traversal algorithm can be active at the same time. For
instance, if your :term:`root factory` returns more than one type of
-object conditionally, you could claim that an alternate traverser is
-``for`` only one particular class or interface. When the root factory
-returned an object that implemented that class or interface, a custom
-traverser would be used. Otherwise, the default traverser would be
-used. For example:
+object conditionally, you could claim that an alternate traverser
+adapter is ``for`` only one particular class or interface. When the
+root factory returned an object that implemented that class or
+interface, a custom traverser would be used. Otherwise, the default
+traverser would be used. For example:
.. code-block:: xml
:linenos:
View
@@ -361,12 +361,13 @@ then both the request type and the context type are "more specific"
for the view registration).
What it all boils down to is: if a request that matches a route
-resolves to a view you don't expect it to, use the ``view_for``
-attribute of the ``route`` statement (*or* the ``for`` attribute of
-the ZCML statement that also has a ``route_name`` *or* the equivalent
-``for_`` parameter to the :class:`repoze.bfg.view.bfg_view` decorator
-that also has a ``route_name`` parameter) to name the specific context
-interface you want the route-related view to match.
+resolves to a view you don't expect it to, use the ``view_context``
+attribute of the ``route`` statement (*or* the ``context`` attribute
+of the ZCML statement that also has a ``route_name`` *or* the
+equivalent ``context`` parameter to the
+:class:`repoze.bfg.view.bfg_view` decorator that also has a
+``route_name`` parameter) to name the specific context interface you
+want the route-related view to match.
Yes, that was as painful for me to write as it was for you to read.
View
@@ -603,12 +603,13 @@ the :term:`application registry`. It looks like so:
in this file.
#. Lines 6-10 register a "default view" (a view that has no ``name``
- attribute). It is ``for`` model objects that are instances of the
+ attribute). It is registered so that it will be found when the
+ :term:`context` of the request is an instance of the
:class:`myproject.models.MyModel` class. The ``view`` attribute
points at a Python function that does all the work for this view.
- Note that the values of both the ``for`` attribute and the ``view``
- attribute begin with a single period. Names that begin with a
- period are "shortcuts" which point at files relative to the
+ Note that the values of both the ``context`` attribute and the
+ ``view`` attribute begin with a single period. Names that begin
+ with a period are "shortcuts" which point at files relative to the
:term:`package` in which the ``configure.zcml`` file lives. In
this case, since the ``configure.zcml`` file lives within the
:mod:`myproject` package, the shortcut ``.models.MyModel`` could
View
@@ -125,7 +125,7 @@ when invoked against a ``Blog`` context with the ``add`` permission:
:linenos:
<view
- for=".models.Blog"
+ context=".models.Blog"
view=".views.blog_entry_add_view"
name="add_entry.html"
permission="add"
@@ -142,7 +142,7 @@ module of your project's package
from repoze.bfg.view import bfg_view
from models import Blog
- @bfg_view(for_=Blog, name='add_entry.html', permission='add')
+ @bfg_view(context=Blog, name='add_entry.html', permission='add')
def blog_entry_add_view(request):
""" Add blog entry code goes here """
pass
Oops, something went wrong.

0 comments on commit eecdbc3

Please sign in to comment.