Avoid trying to deep-copy the whole event
authorKeith Packard <keithp@keithp.com>
Fri, 7 Mar 2014 06:15:16 +0000 (22:15 -0800)
committerKeith Packard <keithp@keithp.com>
Fri, 7 Mar 2014 06:19:36 +0000 (22:19 -0800)
This is causing an exception from deep within python for some reason,
and it's not necessary as we're just writing contents to a file for
later use.

Signed-off-by: Keith Packard <keithp@keithp.com>
calypso/webdav.py

index 9e7fb2bb85a9a1ab32f7a5b4ae75e052d4642d13..85b3bb9680716f639291d09656e6b64516d90b7e 100644 (file)
@@ -498,16 +498,16 @@ class Collection(object):
         try:
             new_ics = vobject.readOne(codecs.open(path,encoding='utf-8').read())
             if new_ics.name == 'VCALENDAR':
-                for ve in new_ics.vevent_list:
-                    copy_ics = copy.deepcopy(new_ics)
 
+                events = new_ics.vevent_list
+                for ve in events:
                     # Check for events with both dtstart and duration entries and
                     # delete the duration one
                     if ve.contents.has_key('dtstart') and ve.contents.has_key('duration'):
                         del ve.contents['duration']
-                    copy_ics.vevent_list = [ve]
-                    copy_item = Item(copy_ics.serialize(), None, path)
-                    self.import_item(copy_item, path)
+                    new_ics.vevent_list = [ve]
+                    new_item = Item(new_ics.serialize(), None, path)
+                    self.import_item(new_item, path)
             else:
                 self.import_item(new_ics)
             return True