[KSS-checkins] r35903 - kukit/kss.core/trunk
jvloothuis at codespeak.net
jvloothuis at codespeak.net
Tue Dec 19 21:16:47 CET 2006
Author: jvloothuis
Date: Tue Dec 19 21:16:45 2006
New Revision: 35903
Modified:
kukit/kss.core/trunk/azaxview.py
kukit/kss.core/trunk/azaxview.txt
Log:
Removed unneeded handle method which did the same as event.notify
Modified: kukit/kss.core/trunk/azaxview.py
==============================================================================
--- kukit/kss.core/trunk/azaxview.py (original)
+++ kukit/kss.core/trunk/azaxview.py Tue Dec 19 21:16:45 2006
@@ -140,12 +140,6 @@
def getCommands(self):
return self.commands
- def handle(self, *args):
- for event in args: # first fire all normal stuff
- notify(event)
- for event in args: # now do the kss bits
- component.handle(AzaxEvent(self, event))
-
def getCommandSet(self, name):
commandset = getRegisteredCommandSet(name)
# return the adapted view
Modified: kukit/kss.core/trunk/azaxview.txt
==============================================================================
--- kukit/kss.core/trunk/azaxview.txt (original)
+++ kukit/kss.core/trunk/azaxview.txt Tue Dec 19 21:16:45 2006
@@ -25,6 +25,7 @@
>>> from zope.app.component.interfaces import ISite
>>> from zope.interface import directlyProvides, directlyProvidedBy
>>> from zope.publisher.browser import TestRequest
+ >>> from zope import event
>>> from zope.app.folder import folder
>>> myfolder = folder.rootFolder()
@@ -39,7 +40,7 @@
>>> class SampleView(AzaxBaseView):
... def add_page(self, title):
... # normally you would change the zope database here
- ... self.handle(ObjectModifiedEvent(title))
+ ... event.notify(ObjectModifiedEvent(title))
... return self.render()
>>> view = SampleView(myfolder, request)
@@ -59,26 +60,6 @@
When we call the renderer now it should have some more data in it.
+ >>> view = SampleView(myfolder, request)
>>> view.add_page("some title")[0]['params']['html']
u'some title'
-
-The example above used our convenience method to generate events. You normally
-do this for all mutations you make yourself. Not all events are generated this
-way though. In case of a workflow transition events may be fired as well. Azax
-views account for this automatically. You don't need to do anything special.
-
-We will demonstrate this using a simple view. This view will generate the
-modified event through normal component api instead of our handle method.
-
- >>> class AnotherView(AzaxBaseView):
- ... def add_page(self, title):
- ... # normally you would change the zope database here
- ... notify(ObjectModifiedEvent(title))
- ... return self.render()
-
-This should now still invoke our handler.
-
- >>> view = AnotherView(myfolder, request)
- >>> view.add_page("another title")[0]['params']['html']
- u'another title'
-
More information about the Kukit-checkins
mailing list