[Checkins] SVN: z3c.flashmessage/trunk/src/z3c/flashmessage/ *
Bugfix: When there was more than one message in a source not
all messages would be returned by the receiver.
Christian Zagrodnick
cz at gocept.com
Wed Sep 12 08:51:03 EDT 2007
Log message for revision 79586:
* Bugfix: When there was more than one message in a source not all messages would be returned by the receiver.
Changed:
U z3c.flashmessage/trunk/src/z3c/flashmessage/README.txt
U z3c.flashmessage/trunk/src/z3c/flashmessage/receiver.py
-=-
Modified: z3c.flashmessage/trunk/src/z3c/flashmessage/README.txt
===================================================================
--- z3c.flashmessage/trunk/src/z3c/flashmessage/README.txt 2007-09-12 12:50:26 UTC (rev 79585)
+++ z3c.flashmessage/trunk/src/z3c/flashmessage/README.txt 2007-09-12 12:51:03 UTC (rev 79586)
@@ -63,18 +63,21 @@
>>> source2 = RAMMessageSource()
>>> provideUtility(source2, name='other')
>>> source2.send(u'Test 2!')
+>>> source2.send(u'Test 3!')
>>> from z3c.flashmessage.receiver import GlobalMessageReceiver
>>> receiver = GlobalMessageReceiver()
>>> m = list(receiver.receive())
>>> len(m)
-3
+4
>>> m[0].message
u'I will stay forever!'
>>> m[1].message
u'Test!'
>>> m[2].message
u'Test 2!'
+>>> m[3].message
+u'Test 3!'
After the receiver handed out the messages, they are gone from the
sources, because the receiver notifies the messages that they were
@@ -99,3 +102,14 @@
[<z3c.flashmessage.message.Message object at 0x...>]
>>> list(source3.list('somethingelse'))
[]
+
+
+
+Changes
+=======
+
+1.0b2
+-----
+
+* Bugfix: When there was more than one message in a source not all messages
+ would be returned by the receiver.
Modified: z3c.flashmessage/trunk/src/z3c/flashmessage/receiver.py
===================================================================
--- z3c.flashmessage/trunk/src/z3c/flashmessage/receiver.py 2007-09-12 12:50:26 UTC (rev 79585)
+++ z3c.flashmessage/trunk/src/z3c/flashmessage/receiver.py 2007-09-12 12:51:03 UTC (rev 79586)
@@ -17,6 +17,9 @@
sources = zope.component.getAllUtilitiesRegisteredFor(
z3c.flashmessage.interfaces.IMessageSource)
for source in sources:
- for message in source.list(type):
+ # We need to create a list here, because message.prepare might
+ # modify the original source list stop the iteration before
+ # all items where consumed:
+ for message in list(source.list(type)):
message.prepare(source)
yield message
More information about the Checkins
mailing list