[Calypso-commits] [calypso] 02/02: Add support for per calendar colors.

Jelmer Vernooij jelmer at moszumanska.debian.org
Sat Apr 9 22:37:43 UTC 2016


This is an automated email from the git hooks/post-receive script.

jelmer pushed a commit to branch master
in repository calypso.

commit 113f1b131c6f8b1b58673da4fabade7fab2a208c
Author: Jelmer Vernooij <jelmer at jelmer.uk>
Date:   Wed Jan 13 02:33:10 2016 +0000

    Add support for per calendar colors.
---
 calypso/webdav.py   | 8 ++++++++
 calypso/xmlutils.py | 3 +++
 2 files changed, 11 insertions(+)

diff --git a/calypso/webdav.py b/calypso/webdav.py
index e059d19..34aacce 100644
--- a/calypso/webdav.py
+++ b/calypso/webdav.py
@@ -585,6 +585,14 @@ class Collection(object):
         return _text
 
     @property
+    def color(self):
+        """Color."""
+        try:
+            return "#%s" % self.metadata.get('collection', 'color')
+        except (ConfigParser.NoSectionError, ConfigParser.NoOptionError, ValueError):
+            return None
+
+    @property
     def headers(self):
         """Find headers items in collection."""
         return []
diff --git a/calypso/xmlutils.py b/calypso/xmlutils.py
index af2ad86..7f9c674 100644
--- a/calypso/xmlutils.py
+++ b/calypso/xmlutils.py
@@ -46,6 +46,7 @@ NAMESPACES = {
     "C": "urn:ietf:params:xml:ns:caldav",
     "A": "urn:ietf:params:xml:ns:carddav",
     "D": "DAV:",
+    "E": "http://apple.com/ns/ical/",
     "CS": "http://calendarserver.org/ns/"}
 
 log = logging.getLogger(__name__)
@@ -177,6 +178,8 @@ def propfind(path, xml_request, collection, depth, context):
                 element.text = item.etag
             elif tag == _tag("D", "displayname") and is_collection:
                 element.text = collection.name
+            elif tag == _tag("E", "calendar-color") and is_collection:
+                element.text = collection.color
             elif tag == _tag("D", "principal-URL"):
                 # TODO: use a real principal URL, read rfc3744-4.2 for info
                 tag = ET.Element(_tag("D", "href"))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/calypso/calypso.git



More information about the Calypso-commits mailing list