[CalendarServer-changes] [2979] CalendarServer/trunk/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Thu Sep 11 11:38:42 PDT 2008
Revision: 2979
http://trac.macosforge.org/projects/calendarserver/changeset/2979
Author: sagen at apple.com
Date: 2008-09-11 11:38:41 -0700 (Thu, 11 Sep 2008)
Log Message:
-----------
Rolling back the simple line notification changes
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/notify.py
CalendarServer/trunk/twistedcaldav/test/test_notify.py
Modified: CalendarServer/trunk/twistedcaldav/notify.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/notify.py 2008-09-11 15:52:28 UTC (rev 2978)
+++ CalendarServer/trunk/twistedcaldav/notify.py 2008-09-11 18:38:41 UTC (rev 2979)
@@ -459,18 +459,14 @@
hist = self.history
toSend = [(hist[uri], uri) for uri in hist if hist[uri] > oldSeq]
+ toSend.sort() # sorts the tuples based on numeric sequence number
- if toSend:
- toSend.sort() # sorts the tuples based on numeric sequence number
- for seq, uri in toSend:
- msg = "%d %s" % (seq, uri)
- self.log_debug("Sending %s" % (msg,))
- observer.sendLine(msg)
- else:
- observer.sendLine("-1")
+ for seq, uri in toSend:
+ msg = "%d %s" % (seq, uri)
+ self.log_debug("Sending %s" % (msg,))
+ observer.sendLine(msg)
-
def addObserver(self, observer):
self.observers.add(observer)
@@ -513,7 +509,10 @@
self.transport.getPeer()))
return
- self.notifier.playback(self, oldSeq)
+ if oldSeq == 0:
+ self.notifier.reset()
+ else:
+ self.notifier.playback(self, oldSeq)
def connectionLost(self, reason):
self.notifier.removeObserver(self)
Modified: CalendarServer/trunk/twistedcaldav/test/test_notify.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_notify.py 2008-09-11 15:52:28 UTC (rev 2978)
+++ CalendarServer/trunk/twistedcaldav/test/test_notify.py 2008-09-11 18:38:41 UTC (rev 2979)
@@ -251,14 +251,8 @@
self.notifier.enqueue("update", "C")
protocol = StubProtocol()
self.notifier.addObserver(protocol)
- self.notifier.playback(protocol, 0)
- self.assertEquals(protocol.lines, ["1 A", "2 B", "3 C"])
- protocol.reset()
self.notifier.playback(protocol, 1)
self.assertEquals(protocol.lines, ["2 B", "3 C"])
- protocol.reset()
- self.notifier.playback(protocol, 5)
- self.assertEquals(protocol.lines, ["-1"])
def test_reset(self):
self.notifier.enqueue("update", "A")
@@ -305,13 +299,11 @@
class StubProtocol(object):
def __init__(self):
- self.reset()
+ self.lines = []
def sendLine(self, line):
self.lines.append(line)
- def reset(self):
- self.lines = []
class StubTransport(object):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080911/0afee4ca/attachment-0001.html
More information about the calendarserver-changes
mailing list