[CalendarServer-changes] [9763] CalendarServer/trunk/twistedcaldav/scheduling

source_changes at macosforge.org source_changes at macosforge.org
Fri Aug 31 13:53:58 PDT 2012


Revision: 9763
          http://trac.macosforge.org/projects/calendarserver/changeset/9763
Author:   cdaboo at apple.com
Date:     2012-08-31 13:53:57 -0700 (Fri, 31 Aug 2012)
Log Message:
-----------
Implicit scheduling generated resources now encode the hash iCalendar UID as part of the resource name.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/scheduling/caldav.py
    CalendarServer/trunk/twistedcaldav/scheduling/processing.py

Modified: CalendarServer/trunk/twistedcaldav/scheduling/caldav.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/caldav.py	2012-08-31 19:16:04 UTC (rev 9762)
+++ CalendarServer/trunk/twistedcaldav/scheduling/caldav.py	2012-08-31 20:53:57 UTC (rev 9763)
@@ -14,19 +14,16 @@
 # limitations under the License.
 ##
 
-import uuid
-
 from twext.python.log import Logger
+from twext.web2 import responsecode
 from twext.web2.dav.http import ErrorResponse
-
-from twisted.internet.defer import inlineCallbacks, returnValue
-from twisted.python.failure import Failure
-from twext.web2 import responsecode
-from txdav.xml import element as davxml
 from twext.web2.dav.resource import AccessDeniedError
 from twext.web2.dav.util import joinURL
 from twext.web2.http import HTTPError
 
+from twisted.internet.defer import inlineCallbacks, returnValue
+from twisted.python.failure import Failure
+
 from twistedcaldav import caldavxml
 from twistedcaldav.caldavxml import caldav_namespace
 from twistedcaldav.config import config
@@ -39,6 +36,11 @@
 from twistedcaldav.scheduling.itip import iTIPRequestStatus
 from twistedcaldav.scheduling.processing import ImplicitProcessor, ImplicitProcessorException
 
+from txdav.xml import element as davxml
+
+import hashlib
+import uuid
+
 """
 Handles the sending of scheduling messages to the server itself. This will cause
 actual processing of the delivery of the message to the recipient's inbox, via the
@@ -141,7 +143,7 @@
     @inlineCallbacks
     def generateResponse(self, recipient, responses):
         # Hash the iCalendar data for use as the last path element of the URI path
-        name = str(uuid.uuid4()) + ".ics"
+        name =  "%s-%s.ics" % (hashlib.md5(self.scheduler.calendar.resourceUID()).hexdigest(), str(uuid.uuid4())[:8],)
     
         # Get a resource for the new item
         childURL = joinURL(recipient.inboxURL, name)

Modified: CalendarServer/trunk/twistedcaldav/scheduling/processing.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/processing.py	2012-08-31 19:16:04 UTC (rev 9762)
+++ CalendarServer/trunk/twistedcaldav/scheduling/processing.py	2012-08-31 20:53:57 UTC (rev 9763)
@@ -37,6 +37,7 @@
 from pycalendar.datetime import PyCalendarDateTime
 from pycalendar.timezone import PyCalendarTimezone
 import uuid
+import hashlib
 
 """
 CalDAV implicit processing.
@@ -471,7 +472,6 @@
 
             log.debug("ImplicitProcessing - originator '%s' to recipient '%s' processing METHOD:REQUEST, UID: '%s' - new processed" % (self.originator.cuaddr, self.recipient.cuaddr, self.uid))
             new_calendar = iTipProcessing.processNewRequest(self.message, self.recipient.cuaddr)
-            name =  str(uuid.uuid4()) + ".ics"
             
             # Handle auto-reply behavior
             if self.recipient.principal.canAutoSchedule():
@@ -483,7 +483,7 @@
                 send_reply = False
                 store_inbox = True
 
-            new_resource = (yield self.writeCalendarResource(default.url(), default, name, new_calendar))
+            new_resource = (yield self.writeCalendarResource(default.url(), default, None, new_calendar))
             
             if send_reply:
                 # Track outstanding auto-reply processing
@@ -900,7 +900,7 @@
         
         # Create a new name if one was not provided
         if name is None:
-            name =  str(uuid.uuid4()) + ".ics"
+            name =  "%s-%s.ics" % (hashlib.md5(calendar.resourceUID()).hexdigest(), str(uuid.uuid4())[:8],)
     
         # Get a resource for the new item
         newchildURL = joinURL(collURL, name)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120831/453ae963/attachment.html>


More information about the calendarserver-changes mailing list