commit
00b498677d
@ -437,6 +437,14 @@ class Collection(object):
|
||||
with self.props as props:
|
||||
return props.get("D:displayname", self.path.split(os.path.sep)[-1])
|
||||
|
||||
@property
|
||||
def color(self):
|
||||
"""Collection color."""
|
||||
with self.props as props:
|
||||
if "A:calendar-color" not in props:
|
||||
props["A:calendar-color"] = "#5ba209"
|
||||
return props["A:calendar-color"]
|
||||
|
||||
@property
|
||||
def headers(self):
|
||||
"""Find headers items in collection."""
|
||||
|
@ -39,6 +39,7 @@ from . import client, config, ical
|
||||
|
||||
|
||||
NAMESPACES = {
|
||||
"A": "http://apple.com/ns/ical/",
|
||||
"C": "urn:ietf:params:xml:ns:caldav",
|
||||
"CR": "urn:ietf:params:xml:ns:carddav",
|
||||
"D": "DAV:",
|
||||
@ -217,6 +218,7 @@ def propfind(path, xml_request, collections, user=None):
|
||||
_tag("D", "displayname"),
|
||||
_tag("D", "owner"),
|
||||
_tag("D", "getetag"),
|
||||
_tag("A", "calendar-color"),
|
||||
_tag("CS", "getctag")]
|
||||
|
||||
# Writing answer
|
||||
@ -331,6 +333,8 @@ def _propfind_response(path, item, props, user):
|
||||
item.tag, item.headers, item.timezones)
|
||||
elif tag == _tag("D", "displayname"):
|
||||
element.text = item.name
|
||||
elif tag == _tag("A", "calendar-color"):
|
||||
element.text = item.color
|
||||
else:
|
||||
human_tag = _tag_from_clark(tag)
|
||||
if human_tag in collection_props:
|
||||
|
Loading…
Reference in New Issue
Block a user