Hey folks, in the what's new for 1.1 I found this:

In repoze.bfg 1.0, the @bfg_view decorator could not be used on class
methods. In 1.1, the @bfg_view decorator can be used against a class
method:

<begin>
1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
from webob import Response
 from repoze.bfg.view import bfg_view

 class MyView(object):
     def __init__(self, context, request):
         self.context = context
         self.request = request

     @bfg_view(name='hello')
     def amethod(self):
         return Response('hello from %s!' % self.context)

When the bfg_view decorator is used against a class method, a view is
registered for the class (it’s a “class view” where the “attr” happens
to be the name of the method it is attached to), so the class it’s
defined within must have a suitable constructor: one that accepts
context, request or just request.
<end>

Am I missing something terribly obvious, or is that not just a regular
instance method in the example? Or am I misunderstanding the point?
Perhaps this part could be clearer, it's confused me at any rate.

btw, the 1.1 improvements are awesome.

Iain

_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to