[CalendarServer-changes] [3397] CalendarServer/trunk/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Wed Nov 19 10:46:53 PST 2008


Revision: 3397
          http://trac.macosforge.org/projects/calendarserver/changeset/3397
Author:   wsanchez at apple.com
Date:     2008-11-19 10:46:53 -0800 (Wed, 19 Nov 2008)
Log Message:
-----------
Get rid of /inbox resource on disk.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/mail.py
    CalendarServer/trunk/twistedcaldav/static.py
    CalendarServer/trunk/twistedcaldav/tap.py

Modified: CalendarServer/trunk/twistedcaldav/mail.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/mail.py	2008-11-19 16:27:48 UTC (rev 3396)
+++ CalendarServer/trunk/twistedcaldav/mail.py	2008-11-19 18:46:53 UTC (rev 3397)
@@ -26,23 +26,25 @@
 
 from twisted.application import internet, service
 from twisted.internet import protocol, defer, ssl
-from twisted.internet.defer import inlineCallbacks, returnValue
+from twisted.internet.defer import inlineCallbacks, returnValue, succeed
 from twisted.mail import pop3client, imap4
 from twisted.mail.smtp import messageid, rfc822date, sendmail
 from twisted.plugin import IPlugin
 from twisted.python.usage import Options, UsageError
 from twisted.web import resource, server, client
+from twisted.web2 import responsecode
 from twisted.web2.dav import davxml
-from twisted.web2.http import Response
+from twisted.web2.http import Response, HTTPError
 from twisted.web2.http_headers import MimeType
 
 from twistedcaldav import ical, caldavxml
 from twistedcaldav.config import config, parseConfig, defaultConfig, defaultConfigFile
 from twistedcaldav.ical import Property
 from twistedcaldav.log import Logger, LoggingMixIn
-from twistedcaldav.resource import CalDAVResource
+from twistedcaldav.directory.util import NotFilePath
 from twistedcaldav.scheduling.scheduler import IMIPScheduler
 from twistedcaldav.scheduling.cuaddress import normalizeCUAddr
+from twistedcaldav.static import CalDAVFile, deliverSchedulePrivilegeSet
 from twistedcaldav.sql import AbstractSQLDatabase
 from twistedcaldav.localization import translationTo
 
@@ -154,7 +156,7 @@
 
 
 
-class IMIPInboxResource(CalDAVResource):
+class IMIPInboxResource(CalDAVFile):
     """
     IMIP-delivery Inbox resource.
 
@@ -167,26 +169,10 @@
         """
         assert parent is not None
 
-        CalDAVResource.__init__(self, principalCollections=parent.principalCollections())
+        CalDAVFile.__init__(self, NotFilePath(isfile=True), principalCollections=parent.principalCollections())
 
         self.parent = parent
 
-    def defaultAccessControlList(self):
-        privs = (
-            davxml.Privilege(davxml.Read()),
-            davxml.Privilege(caldavxml.ScheduleDeliver()),
-        )
-        if config.Scheduling.CalDAV.OldDraftCompatibility:
-            privs += (davxml.Privilege(caldavxml.Schedule()),)
-        return davxml.ACL(
-            # DAV:Read, CalDAV:schedule-deliver for all principals (includes anonymous)
-            davxml.ACE(
-                davxml.Principal(davxml.All()),
-                davxml.Grant(*privs),
-                davxml.Protected(),
-            ),
-        )
-
     def resourceType(self):
         return davxml.ResourceType.ischeduleinbox
 
@@ -229,8 +215,38 @@
         result = (yield scheduler.doSchedulingViaPOST())
         returnValue(result.response())
 
+    ##
+    # File
+    ##
 
+    def createSimilarFile(self, path):
+        log.err("Attempt to create clone %r of resource %r" % (path, self))
+        raise HTTPError(responsecode.NOT_FOUND)
 
+    ##
+    # ACL
+    ##
+
+    def defaultAccessControlList(self):
+        privs = (
+            davxml.Privilege(davxml.Read()),
+            davxml.Privilege(caldavxml.ScheduleDeliver()),
+        )
+        if config.Scheduling.CalDAV.OldDraftCompatibility:
+            privs += (davxml.Privilege(caldavxml.Schedule()),)
+        return davxml.ACL(
+            # DAV:Read, CalDAV:schedule-deliver for all principals (includes anonymous)
+            davxml.ACE(
+                davxml.Principal(davxml.All()),
+                davxml.Grant(*privs),
+                davxml.Protected(),
+            ),
+        )
+
+    def supportedPrivileges(self, request):
+        return succeed(deliverSchedulePrivilegeSet)
+
+
 def injectMessage(organizer, attendee, calendar, msgId, reactor=None):
 
     if reactor is None:

Modified: CalendarServer/trunk/twistedcaldav/static.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/static.py	2008-11-19 16:27:48 UTC (rev 3396)
+++ CalendarServer/trunk/twistedcaldav/static.py	2008-11-19 18:46:53 UTC (rev 3397)
@@ -24,7 +24,6 @@
     "CalendarHomeProvisioningFile",
     "CalendarHomeUIDProvisioningFile",
     "CalendarHomeFile",
-    "IMIPInboxFile",
     "ScheduleFile",
     "ScheduleInboxFile",
     "ScheduleOutboxFile",
@@ -67,7 +66,6 @@
 from twistedcaldav.index import Index, IndexSchedule
 from twistedcaldav.resource import CalDAVResource, isCalendarCollectionResource, isPseudoCalendarCollectionResource
 from twistedcaldav.schedule import ScheduleInboxResource, ScheduleOutboxResource, IScheduleInboxResource
-from twistedcaldav.mail import IMIPInboxResource
 from twistedcaldav.dropbox import DropBoxHomeResource, DropBoxCollectionResource
 from twistedcaldav.directory.calendar import uidsResourceName
 from twistedcaldav.directory.calendar import DirectoryCalendarHomeProvisioningResource
@@ -899,48 +897,6 @@
     def supportedPrivileges(self, request):
         return succeed(deliverSchedulePrivilegeSet)
 
-class IMIPInboxFile (IMIPInboxResource, CalDAVFile):
-    """
-    Mail gateway IMIP-delivery resource.
-    """
-    def __init__(self, path, parent):
-        CalDAVFile.__init__(self, path, principalCollections=parent.principalCollections())
-        IMIPInboxResource.__init__(self, parent)
-        
-        self.fp.open("w").close()
-        self.fp.restat(False)
-
-    def __repr__(self):
-        return "<%s (IMIP delivery resource): %s>" % (self.__class__.__name__, self.fp.path)
-
-    def isCollection(self):
-        return False
-
-    def createSimilarFile(self, path):
-        if path == self.fp.path:
-            return self
-        else:
-            return responsecode.NOT_FOUND
-
-    def http_PUT        (self, request): return responsecode.FORBIDDEN
-    def http_COPY       (self, request): return responsecode.FORBIDDEN
-    def http_MOVE       (self, request): return responsecode.FORBIDDEN
-    def http_DELETE     (self, request): return responsecode.FORBIDDEN
-    def http_MKCOL      (self, request): return responsecode.FORBIDDEN
-
-    def http_MKCALENDAR(self, request):
-        return ErrorResponse(
-            responsecode.FORBIDDEN,
-            (caldav_namespace, "calendar-collection-location-ok")
-        )
-
-    ##
-    # ACL
-    ##
-
-    def supportedPrivileges(self, request):
-        return succeed(deliverSchedulePrivilegeSet)
-
 class FreeBusyURLFile (AutoProvisioningFileMixIn, FreeBusyURLResource, CalDAVFile):
     """
     Free-busy URL resource.

Modified: CalendarServer/trunk/twistedcaldav/tap.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/tap.py	2008-11-19 16:27:48 UTC (rev 3396)
+++ CalendarServer/trunk/twistedcaldav/tap.py	2008-11-19 18:46:53 UTC (rev 3397)
@@ -53,7 +53,7 @@
 from twistedcaldav.static import CalendarHomeProvisioningFile
 from twistedcaldav.static import IScheduleInboxFile
 from twistedcaldav.static import TimezoneServiceFile
-from twistedcaldav.static import IMIPInboxFile
+from twistedcaldav.mail import IMIPInboxResource
 from twistedcaldav.timezones import TimezoneCache
 from twistedcaldav.upgrade import UpgradeTheServer
 from twistedcaldav import pdmonster
@@ -380,7 +380,7 @@
     principalResourceClass       = DirectoryPrincipalProvisioningResource
     calendarResourceClass        = CalendarHomeProvisioningFile
     iScheduleResourceClass       = IScheduleInboxFile
-    imipResourceClass            = IMIPInboxFile
+    imipResourceClass            = IMIPInboxResource
     timezoneServiceResourceClass = TimezoneServiceFile
 
     def makeService_Slave(self, options):
@@ -515,10 +515,7 @@
         log.info("Setting up iMIP inbox resource: %r"
                  % (self.imipResourceClass,))
 
-        imipInbox = self.imipResourceClass(
-            os.path.join(config.DocumentRoot, "inbox"),
-            root,
-        )
+        imipInbox = self.imipResourceClass(root)
         root.putChild("inbox", imipInbox)
 
         #
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081119/570f575d/attachment.html>


More information about the calendarserver-changes mailing list