summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2015-03-24 18:17:39 +0100
committerThomas Bruederli <bruederli@kolabsys.com>2015-03-24 18:17:39 +0100
commitd222679e9db6abf76578f9b6c5e4ffb96464495c (patch)
treeee5e4e861d46e5bbb1d5e4faefc4430b7a1d794b
parent70eef55a67dd05a0648e0a969c10400903e19d2a (diff)
downloadpykolab-d222679e9db6abf76578f9b6c5e4ffb96464495c.tar.gz
Add getter for related-to property of todo objects
-rw-r--r--pykolab/xml/todo.py6
-rw-r--r--tests/unit/test-016-todo.py4
2 files changed, 10 insertions, 0 deletions
diff --git a/pykolab/xml/todo.py b/pykolab/xml/todo.py
index adc4e2b..2103427 100644
--- a/pykolab/xml/todo.py
+++ b/pykolab/xml/todo.py
@@ -47,6 +47,7 @@ class Todo(Event):
self.properties_map.update({
"due": "get_due",
"percent-complete": "get_percentcomplete",
+ "related-to": "get_related_to",
"duration": "void",
"end": "void"
})
@@ -184,6 +185,11 @@ class Todo(Event):
def get_duration(self):
return None
+ def get_related_to(self):
+ for x in self.event.relatedTo():
+ return x
+ return None
+
def as_string_itip(self, method="REQUEST"):
cal = icalendar.Calendar()
cal.add(
diff --git a/tests/unit/test-016-todo.py b/tests/unit/test-016-todo.py
index 91562c3..b94d12d 100644
--- a/tests/unit/test-016-todo.py
+++ b/tests/unit/test-016-todo.py
@@ -114,6 +114,9 @@ xml_todo = """
<categories>
<text>iTip</text>
</categories>
+ <related-to>
+ <text>9F3E68BED4A94DA2A51EE589F7FDC6C8-A4BF5BBB9FEAA271</text>
+ </related-to>
<dtstart>
<parameters>
<tzid><text>/kolab.org/Europe/Berlin</text></tzid>
@@ -222,6 +225,7 @@ class TestTodoXML(unittest.TestCase):
self.assertIsInstance(todo.get_organizer(), kolabformat.ContactReference)
self.assertEqual(todo.get_organizer().name(), "Thomas")
self.assertEqual(todo.get_status(True), "IN-PROCESS")
+ self.assertEqual(todo.get_related_to(), "9F3E68BED4A94DA2A51EE589F7FDC6C8-A4BF5BBB9FEAA271")
def test_020_load_from_ical(self):