[CalendarServer-changes] [6820] CalendarServer/trunk/contrib/performance/loadtest/subscribe.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Jan 28 14:26:27 PST 2011


Revision: 6820
          http://trac.macosforge.org/projects/calendarserver/changeset/6820
Author:   exarkun at twistedmatrix.com
Date:     2011-01-28 14:26:27 -0800 (Fri, 28 Jan 2011)
Log Message:
-----------
Simple event subscription helper for ical.py to expose calendar events to profiles

Added Paths:
-----------
    CalendarServer/trunk/contrib/performance/loadtest/subscribe.py

Added: CalendarServer/trunk/contrib/performance/loadtest/subscribe.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/subscribe.py	                        (rev 0)
+++ CalendarServer/trunk/contrib/performance/loadtest/subscribe.py	2011-01-28 22:26:27 UTC (rev 6820)
@@ -0,0 +1,30 @@
+
+class Subscription(object):
+    def __init__(self, periodical, subscriber):
+        self.periodical = periodical
+        self.subscriber = subscriber
+
+
+    def cancel(self):
+        self.peridical.subscriptions.remove(self)
+
+
+    def issue(self, issue):
+        self.subscriber(issue)
+
+        
+
+class Periodical(object):
+    def __init__(self):
+        self.subscriptions = []
+
+
+    def subscribe(self, who):
+        subscription = Subscription(self, who)
+        self.subscriptions.append(subscription)
+        return subscription
+
+
+    def issue(self, issue):
+        for subscr in self.subscriptions:
+            subscr.issue(issue)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110128/046c5f4c/attachment.html>


More information about the calendarserver-changes mailing list