瀏覽代碼

Add the "set_mimetype" method forgotten during the merge (closes #657)

Guillaume Ayoub 14 年之前
父節點
當前提交
54aa8817e7
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      radicale/ical.py

+ 9 - 0
radicale/ical.py

@@ -362,6 +362,15 @@ class Collection(object):
         text = serialize(headers, items)
         self.save(text)
 
+    def set_mimetype(self, mimetype):
+        """Set the mimetype of the collection."""
+        with self.props as props:
+            if "tag" not in props:
+                if mimetype == "text/vcard":
+                    props["tag"] = "VADDRESSBOOK"
+                else:
+                    props["tag"] = "VCALENDAR"
+
     @property
     def tag(self):
         """Type of the collection."""