[CalendarServer-changes] [4420] CalendarServer/branches/users/sagen/pending-invites-4418

source_changes at macosforge.org source_changes at macosforge.org
Thu Jul 2 14:32:53 PDT 2009


Revision: 4420
          http://trac.macosforge.org/projects/calendarserver/changeset/4420
Author:   sagen at apple.com
Date:     2009-07-02 14:32:52 -0700 (Thu, 02 Jul 2009)
Log Message:
-----------
Branch now has latest from trunk (4418)

Modified Paths:
--------------
    CalendarServer/branches/users/sagen/pending-invites-4418/calendarserver/tap/caldav.py
    CalendarServer/branches/users/sagen/pending-invites-4418/twisted/plugins/caldav.py
    CalendarServer/branches/users/sagen/pending-invites-4418/twistedcaldav/scheduling/scheduler.py
    CalendarServer/branches/users/sagen/pending-invites-4418/twistedcaldav/test/test_upgrade.py
    CalendarServer/branches/users/sagen/pending-invites-4418/twistedcaldav/upgrade.py

Modified: CalendarServer/branches/users/sagen/pending-invites-4418/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/branches/users/sagen/pending-invites-4418/calendarserver/tap/caldav.py	2009-07-02 21:29:13 UTC (rev 4419)
+++ CalendarServer/branches/users/sagen/pending-invites-4418/calendarserver/tap/caldav.py	2009-07-02 21:32:52 UTC (rev 4420)
@@ -39,6 +39,7 @@
 from twisted.python.usage import Options, UsageError
 from twisted.python.reflect import namedClass
 from twisted.plugin import IPlugin
+from twisted.internet.defer import DeferredList, succeed, inlineCallbacks, returnValue
 from twisted.internet.reactor import callLater
 from twisted.internet.process import ProcessExitedAlready
 from twisted.internet.protocol import Protocol, Factory
@@ -1105,6 +1106,24 @@
 
             monitor.addProcess("mailgateway", mailGatewayArgv, env=parentEnv)
 
+        self.log_info("Adding task service")
+        taskArgv = [
+            sys.executable,
+            config.Twisted.twistd,
+        ]
+        if config.UserName:
+            taskArgv.extend(("-u", config.UserName))
+        if config.GroupName:
+            taskArgv.extend(("-g", config.GroupName))
+        taskArgv.extend((
+            "--reactor=%s" % (config.Twisted.reactor,),
+            "-n", "caldav_task",
+            "-f", options["config"],
+        ))
+
+        monitor.addProcess("caldav_task", taskArgv, env=parentEnv)
+
+
         stats = CalDAVStatisticsServer(logger) 
         statsService = UNIXServer(config.GlobalStatsSocket, stats) 
         statsService.setServiceParent(s)
@@ -1159,6 +1178,8 @@
                         self.log_warn("Deleting stale socket file (not accepting connections): %s" % checkSocket)
                         os.remove(checkSocket)
 
+
+
 class TwistdSlaveProcess(object):
     prefix = "caldav"
 

Modified: CalendarServer/branches/users/sagen/pending-invites-4418/twisted/plugins/caldav.py
===================================================================
--- CalendarServer/branches/users/sagen/pending-invites-4418/twisted/plugins/caldav.py	2009-07-02 21:29:13 UTC (rev 4419)
+++ CalendarServer/branches/users/sagen/pending-invites-4418/twisted/plugins/caldav.py	2009-07-02 21:32:52 UTC (rev 4420)
@@ -34,5 +34,6 @@
 
 
 TwistedCalDAV     = TAP("calendarserver.tap.caldav.CalDAVServiceMaker")
+CalDAVTask        = TAP("calendarserver.sidecar.task.CalDAVTaskServiceMaker")
 CalDAVNotifier    = TAP("twistedcaldav.notify.NotificationServiceMaker")
 CalDAVMailGateway = TAP("twistedcaldav.mail.MailGatewayServiceMaker")

Modified: CalendarServer/branches/users/sagen/pending-invites-4418/twistedcaldav/scheduling/scheduler.py
===================================================================
--- CalendarServer/branches/users/sagen/pending-invites-4418/twistedcaldav/scheduling/scheduler.py	2009-07-02 21:29:13 UTC (rev 4419)
+++ CalendarServer/branches/users/sagen/pending-invites-4418/twistedcaldav/scheduling/scheduler.py	2009-07-02 21:32:52 UTC (rev 4420)
@@ -55,6 +55,7 @@
     "CalDAVScheduler",
     "IScheduleScheduler",
     "IMIPScheduler",
+    "DirectScheduler",
 ]
 
 
@@ -386,7 +387,7 @@
             # Now process iMIP recipients
             if imip_recipients:
                 yield self.generateIMIPSchedulingResponses(imip_recipients, responses, freebusy)
-    
+
         # Return with final response if we are done
         returnValue(responses)
     
@@ -789,6 +790,31 @@
             log.err(msg)
             raise HTTPError(ErrorResponse(responsecode.FORBIDDEN, (caldav_namespace, "valid-calendar-data"), description=msg))
 
+
+class DirectScheduler(Scheduler):
+
+    def checkAuthorization(self):
+        pass
+
+    def checkOrganizer(self):
+        pass
+
+    def checkOrganizerAsOriginator(self):
+        pass
+
+    def checkAttendeeAsOriginator(self):
+        pass
+
+    def securityChecks(self):
+        pass
+
+    def checkOriginator(self):
+        pass
+
+    def checkRecipients(self):
+        pass
+
+
 class IMIPScheduler(Scheduler):
 
     def checkAuthorization(self):

Modified: CalendarServer/branches/users/sagen/pending-invites-4418/twistedcaldav/test/test_upgrade.py
===================================================================
--- CalendarServer/branches/users/sagen/pending-invites-4418/twistedcaldav/test/test_upgrade.py	2009-07-02 21:29:13 UTC (rev 4419)
+++ CalendarServer/branches/users/sagen/pending-invites-4418/twistedcaldav/test/test_upgrade.py	2009-07-02 21:32:52 UTC (rev 4420)
@@ -282,6 +282,12 @@
         }
 
         after = {
+            "tasks" :
+            {
+                "incoming" :
+                {
+                },
+            },
             ".calendarserver_version" :
             {
                 "@contents" : "1",
@@ -406,6 +412,12 @@
         }
 
         after = {
+            "tasks" :
+            {
+                "incoming" :
+                {
+                },
+            },
             ".calendarserver_version" :
             {
                 "@contents" : "1",
@@ -525,6 +537,12 @@
         }
 
         after = {
+            "tasks" :
+            {
+                "incoming" :
+                {
+                },
+            },
             ".calendarserver_version" :
             {
                 "@contents" : "1",
@@ -650,6 +668,12 @@
         }
 
         after = {
+            "tasks" :
+            {
+                "incoming" :
+                {
+                },
+            },
             ".calendarserver_version" :
             {
                 "@contents" : "1",
@@ -761,6 +785,12 @@
 
 
         after = {
+            "tasks" :
+            {
+                "incoming" :
+                {
+                },
+            },
             "calendars" :
             {
                 "__uids__" :

Modified: CalendarServer/branches/users/sagen/pending-invites-4418/twistedcaldav/upgrade.py
===================================================================
--- CalendarServer/branches/users/sagen/pending-invites-4418/twistedcaldav/upgrade.py	2009-07-02 21:29:13 UTC (rev 4419)
+++ CalendarServer/branches/users/sagen/pending-invites-4418/twistedcaldav/upgrade.py	2009-07-02 21:32:52 UTC (rev 4420)
@@ -286,7 +286,22 @@
         if os.path.exists(dbPath):
             os.chown(dbPath, uid, gid)
 
+    def createTaskServiceDirectory(config, uid, gid):
 
+        taskDir = os.path.join(config.DataRoot, "tasks")
+        if not os.path.exists(taskDir):
+            os.mkdir(taskDir)
+        os.chown(taskDir, uid, gid)
+
+        incomingDir = os.path.join(taskDir, "incoming")
+        if not os.path.exists(incomingDir):
+            os.mkdir(incomingDir)
+        os.chown(incomingDir, uid, gid)
+
+        return incomingDir
+
+
+
     directory = getDirectory()
 
     docRoot = config.DocumentRoot
@@ -354,8 +369,10 @@
                     os.rmdir(dirPath)
 
 
-            # Count how many calendar homes we'll be processing
+            # Count how many calendar homes we'll be processing, and build
+            # list of pending inbox items
             total = 0
+            inboxItems = set()
             for first in os.listdir(uidHomes):
                 if len(first) == 2:
                     firstPath = os.path.join(uidHomes, first)
@@ -364,7 +381,21 @@
                             secondPath = os.path.join(firstPath, second)
                             for home in os.listdir(secondPath):
                                 total += 1
+                                homePath = os.path.join(secondPath, home)
+                                inboxPath = os.path.join(homePath, "inbox")
+                                if os.path.exists(inboxPath):
+                                    for inboxItem in os.listdir(inboxPath):
+                                        if not inboxItem.startswith("."):
+                                            inboxItems.add(os.path.join(inboxPath, inboxItem))
 
+            incomingDir = createTaskServiceDirectory(config, uid, gid)
+            if inboxItems:
+                taskFile = os.path.join(incomingDir, "scheduleinboxes.task")
+                with open(taskFile, "w") as out:
+                    for item in inboxItems:
+                        out.write("%s\n" % (item))
+                os.chown(taskFile, uid, gid)
+
             if total:
                 log.warn("Processing %d calendar homes in %s" % (total, uidHomes))
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090702/eac63c14/attachment-0001.html>


More information about the calendarserver-changes mailing list