[CalendarServer-changes] [12777] CalendarServer/trunk/calendarserver/webadmin

source_changes at macosforge.org source_changes at macosforge.org
Thu Feb 27 18:29:10 PST 2014


Revision: 12777
          http://trac.calendarserver.org//changeset/12777
Author:   wsanchez at apple.com
Date:     2014-02-27 18:29:10 -0800 (Thu, 27 Feb 2014)
Log Message:
-----------
poll in render()

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/webadmin/work.py
    CalendarServer/trunk/calendarserver/webadmin/work.xhtml

Modified: CalendarServer/trunk/calendarserver/webadmin/work.py
===================================================================
--- CalendarServer/trunk/calendarserver/webadmin/work.py	2014-02-28 02:02:46 UTC (rev 12776)
+++ CalendarServer/trunk/calendarserver/webadmin/work.py	2014-02-28 02:29:10 UTC (rev 12777)
@@ -29,7 +29,7 @@
 
 from zope.interface import implementer
 
-from twisted.internet.defer import inlineCallbacks  # , returnValue
+from twisted.internet.defer import inlineCallbacks, returnValue
 # from twisted.web.template import tags as html, renderer
 
 # from txdav.caldav.datastore.scheduling.imip.inbound import (
@@ -94,6 +94,12 @@
 
 
     @inlineCallbacks
+    def render(self, request):
+        yield self.poll()
+        returnValue(super(WorkEventsResource, self).render(request))
+
+
+    @inlineCallbacks
     def poll(self):
         txn = self._store.newTransaction()
 
@@ -140,21 +146,18 @@
 
             payload[workDescription] = categoryData
 
+        self.addEvents((
+            dict(
+                eventClass=u"work",
+                eventText=asJSON(payload),
+            ),
+        ))
 
-        print(payload)
-
-        # self._workEventsResource.addEvents((
-        #     dict(
-        #         eventClass=u"work",
-        #         eventText=asJSON(payload),
-        #     ),
-        # ))
-
         if not hasattr(self, "_clock"):
             from twisted.internet import reactor
             self._clock = reactor
 
-        self._clock.callLater(5, self.poll)
+        # self._clock.callLater(5, self.poll)
 
 
 

Modified: CalendarServer/trunk/calendarserver/webadmin/work.xhtml
===================================================================
--- CalendarServer/trunk/calendarserver/webadmin/work.xhtml	2014-02-28 02:02:46 UTC (rev 12776)
+++ CalendarServer/trunk/calendarserver/webadmin/work.xhtml	2014-02-28 02:29:10 UTC (rev 12777)
@@ -83,6 +83,7 @@
 
       window.onload = function() {
         initChart();
+        initEventSource();
       };
 
     </script>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140227/6ea89481/attachment-0001.html>


More information about the calendarserver-changes mailing list