[Calypso] [PATCH] Add support for addressbook-description and calendar-description attributes.
Jelmer Vernooij
jelmer at samba.org
Sat Mar 8 17:12:09 PST 2014
See RFC4791, par 5.2.1.
---
calypso/webdav.py | 7 +++++++
calypso/xmlutils.py | 3 +++
2 files changed, 10 insertions(+)
diff --git a/calypso/webdav.py b/calypso/webdav.py
index 85b3bb9..c8affa3 100644
--- a/calypso/webdav.py
+++ b/calypso/webdav.py
@@ -232,6 +232,13 @@ class CalypsoError(Exception):
class Collection(object):
"""Internal collection class."""
+ def get_description(self):
+ f = codecs.open(os.path.join(self.path, ".git/description"), encoding='utf-8')
+ try:
+ return f.read()
+ finally:
+ f.close()
+
def read_file(self, path):
text = codecs.open(path,encoding='utf-8').read()
item = Item(text, None, path)
diff --git a/calypso/xmlutils.py b/calypso/xmlutils.py
index a1e8c8c..98c7bad 100644
--- a/calypso/xmlutils.py
+++ b/calypso/xmlutils.py
@@ -210,6 +210,9 @@ def propfind(path, xml_request, collection, depth):
# element.text = time.strftime("%a, %d %b %Y %H:%M:%S +0000", item.last_modified)
# element.text = email.utils.formatdate(item.last_modified)
element.text = email.utils.formatdate(time.mktime(item.last_modified))
+ elif tag in (_tag("A", "addressbook-description"),
+ _tag("C", "calendar-description")) and is_collection:
+ element.text = collection.get_description()
prop.append(element)
status = ET.Element(_tag("D", "status"))
--
1.9.0.279.gdc9e3eb
More information about the Calypso
mailing list