diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-11-02 03:02:35 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-11-02 03:02:35 +0000 |
| commit | 8dedfad9e666bccc84c52d1440e8acf9bff215e3 (patch) | |
| tree | 6f54ff31a2ec74004437beb13439a4fbbf70ed99 /docs | |
| parent | 716c9d7dde3a1d6419136bd737fec676c2cb1063 (diff) | |
| download | pyramid-8dedfad9e666bccc84c52d1440e8acf9bff215e3.tar.gz pyramid-8dedfad9e666bccc84c52d1440e8acf9bff215e3.tar.bz2 pyramid-8dedfad9e666bccc84c52d1440e8acf9bff215e3.zip | |
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/whatsnew-1.1.rst | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/docs/whatsnew-1.1.rst b/docs/whatsnew-1.1.rst index f1cdc3b2c..e84d38a13 100644 --- a/docs/whatsnew-1.1.rst +++ b/docs/whatsnew-1.1.rst @@ -409,7 +409,7 @@ hardcode path values in template URLs. The view machinery defaults to using the ``__call__`` method of the view callable (or the function itself, if the view callable is a -function) to obtain a response dictionary. +function) to obtain a response. In :mod:`repoze.bfg` 1.1, the ``attr`` view configuration value allows you to vary the attribute of a view callable used to obtain the @@ -421,7 +421,32 @@ For example, if your view is a class, and the class has a method named in the view configuration for the view. Specifying ``attr`` is most useful when the view definition is a -class. +class. For example: + +.. code-block:: xml + :linenos: + + <view + view=".views.MyViewClass" + attr="index" + /> + +The referenced ``MyViewClass`` might look like so: + +.. code-block:: python + :linenos: + + from webob import Response + + class MyViewClass(object): + def __init__(context, request): + self.context = context + self.request = request + + def index(self): + return Response('OK') + +The ``index`` method of the class will be used to obtain a response. ``@bfg_view`` Decorators May Now Be Stacked ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
