From 1dc3907e59995852d5ee0251c1c92a360f03ed35 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 18 Oct 2009 05:50:54 +0000 Subject: - The ``@bfg_view`` decorator can now be used against a class method:: 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 method they're attached to), so the view class must have a suitable constructor. --- CHANGES.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'CHANGES.txt') diff --git a/CHANGES.txt b/CHANGES.txt index b9de23d9f..b700aaed5 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -19,6 +19,25 @@ Features This makes it possible to associate more than one view configuration for a single callable without requiring ZCML. +- The ``@bfg_view`` decorator can now be used against a class method:: + + 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 method they're attached to), so the view class + must have a suitable constructor. + 1.1a6 (2009-10-15) ================== -- cgit v1.2.3