[conduit/syncml: 84/244] If we try to load a VCALENDAR, only look at the VEVENT



commit 57aff115d1ada21d01d46f3bc40924fed1ca4a5c
Author: John Carr <john carr unrouted co uk>
Date:   Fri Apr 24 07:38:17 2009 -0700

    If we try to load a VCALENDAR, only look at the VEVENT
---
 conduit/datatypes/Event.py |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/conduit/datatypes/Event.py b/conduit/datatypes/Event.py
index 5671863..75871da 100644
--- a/conduit/datatypes/Event.py
+++ b/conduit/datatypes/Event.py
@@ -1,4 +1,4 @@
-import vobject 
+import vobject
 import re
 import conduit.datatypes.DataType as DataType
 
@@ -12,7 +12,11 @@ class Event(DataType.DataType):
         self.iCal = vobject.iCalendar()
 
     def set_from_ical_string(self, string):
-        self.iCal = vobject.readOne(string)
+        o = vobject.readOne(string)
+        if o.name == "VCALENDAR":
+            self.iCal = o.vevent
+        else:
+            self.iCal = o
 
     def get_ical_string(self, version=1.0):
         return self.iCal.serialize()
@@ -25,7 +29,7 @@ class Event(DataType.DataType):
     def __setstate__(self, data):
         self.set_from_ical_string(data['ical'])
         DataType.DataType.__setstate__(self, data)
-        
+
     def get_hash(self):
         ical_string = self.get_ical_string()
         p = re.compile('CREATED:.*\n')



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]