[CalendarServer-changes] [8053] CalendarServer/trunk/txdav/caldav/datastore/util.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Sep 7 10:12:43 PDT 2011


Revision: 8053
          http://trac.macosforge.org/projects/calendarserver/changeset/8053
Author:   cdaboo at apple.com
Date:     2011-09-07 10:12:43 -0700 (Wed, 07 Sep 2011)
Log Message:
-----------
Only migrate attachments once.

Modified Paths:
--------------
    CalendarServer/trunk/txdav/caldav/datastore/util.py

Modified: CalendarServer/trunk/txdav/caldav/datastore/util.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/util.py	2011-09-06 23:28:34 UTC (rev 8052)
+++ CalendarServer/trunk/txdav/caldav/datastore/util.py	2011-09-07 17:12:43 UTC (rev 8053)
@@ -166,11 +166,13 @@
             for attachment in (yield calendarObject.attachments()):
                 name = attachment.name()
                 ctype = attachment.contentType()
-                newattachment = yield outObject.createAttachmentWithName(name)
-                transport = newattachment.store(ctype)
-                proto =_AttachmentMigrationProto(transport)
-                attachment.retrieve(proto)
-                yield proto.done
+                exists = yield outObject.attachmentWithName(name)
+                if exists is None:
+                    newattachment = yield outObject.createAttachmentWithName(name)
+                    transport = newattachment.store(ctype)
+                    proto =_AttachmentMigrationProto(transport)
+                    attachment.retrieve(proto)
+                    yield proto.done
             
             ok_count += 1 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110907/42b734ae/attachment.html>


More information about the calendarserver-changes mailing list