Forráskód Böngészése

Better detection of vcards

Guillaume Ayoub 14 éve
szülő
commit
36918232c0
1 módosított fájl, 6 hozzáadás és 1 törlés
  1. 6 1
      radicale/ical.py

+ 6 - 1
radicale/ical.py

@@ -390,12 +390,17 @@ class Collection(object):
         with self.props as props:
             if "tag" not in props:
                 try:
-                    props["tag"] = open(self.path).readlines()[0][6:].rstrip()
+                    tag = open(self.path).readlines()[0][6:].rstrip()
                 except IOError:
                     if self.path.endswith(".vcf"):
                         props["tag"] = "VADDRESSBOOK"
                     else:
                         props["tag"] = "VCALENDAR"
+                else:
+                    if tag in ("VADDRESSBOOK", "VCARD"):
+                        props["tag"] = "VADDRESSBOOK"
+                    else:
+                        props["tag"] = "VCALENDAR"
             return props["tag"]
 
     @property