[Checkins] SVN: grok/trunk/src/grok/ return decorated function in
SubscribeDecorator, allowing it to be called direclty if
needed; added test for this new feature
Luciano Ramalho
luciano at ramalho.org
Sun Sep 23 05:10:31 EDT 2007
Log message for revision 79846:
return decorated function in SubscribeDecorator, allowing it to be called direclty if needed; added test for this new feature
Changed:
U grok/trunk/src/grok/_grok.py
U grok/trunk/src/grok/tests/event/subscriber.py
-=-
Modified: grok/trunk/src/grok/_grok.py
===================================================================
--- grok/trunk/src/grok/_grok.py 2007-09-22 22:49:04 UTC (rev 79845)
+++ grok/trunk/src/grok/_grok.py 2007-09-23 09:10:29 UTC (rev 79846)
@@ -136,6 +136,7 @@
if subscribers is None:
frame.f_locals['__grok_subscribers__'] = subscribers = []
subscribers.append((function, self.subscribed))
+ return function
from zope.component._declaration import adapter as _adapter
class adapter(_adapter):
Modified: grok/trunk/src/grok/tests/event/subscriber.py
===================================================================
--- grok/trunk/src/grok/tests/event/subscriber.py 2007-09-22 22:49:04 UTC (rev 79845)
+++ grok/trunk/src/grok/tests/event/subscriber.py 2007-09-23 09:10:29 UTC (rev 79846)
@@ -8,6 +8,12 @@
['Manfred']
>>> mammoths2
['Manfred']
+
+The decorated event handling function can also be called directly:
+
+ >>> mammothAdded(Mammoth('Max'),None)
+ >>> mammoths
+ ['Manfred', 'Max']
"""
import grok
More information about the Checkins
mailing list