summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-05-24 11:48:23 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-05-24 11:48:23 +0100
commitf4f1183d1a66df1d4faff511b178867d879a90b1 (patch)
tree146227c598fa951934de57c773d9dbce353b833f
parent4063fbf9ddc282696f0a514f4332fb8505014617 (diff)
downloadpykolab-f4f1183d1a66df1d4faff511b178867d879a90b1.tar.gz
Add delegate_from(delegators) and delegate_to(delegatees) functions
Add various setter and getter functions
-rw-r--r--pykolab/xml/attendee.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/pykolab/xml/attendee.py b/pykolab/xml/attendee.py
index 8d41c49..4f06cef 100644
--- a/pykolab/xml/attendee.py
+++ b/pykolab/xml/attendee.py
@@ -68,6 +68,53 @@ class Attendee(kolabformat.Attendee):
if not cutype == None:
self.set_cutype(cutype)
+ def delegate_from(self, delegators):
+ crefs = []
+
+ if not isinstance(delegators, list):
+ delegators = [delegators]
+
+ for delegator in delegators:
+ if not isinstance(delegator, Attendee):
+ raise ValueError, _("Not a valid attendee")
+ else:
+ crefs.append(delegator.contactreference)
+
+ if len(crefs) == 0:
+ raise ValueError, _("No valid delegator references found")
+ else:
+ crefs += self.get_delegated_from()
+
+ self.setDelegatedFrom(list(set(crefs)))
+
+ def delegate_to(self, delegatees):
+ crefs = []
+ if not isinstance(delegatees, list):
+ delegatees = [delegatees]
+
+ for delegatee in delegatees:
+
+ if not isinstance(delegatee, Attendee):
+ raise ValueError, _("Not a valid attendee")
+ else:
+ crefs.append(delegatee.contactreference)
+
+ if len(crefs) == 0:
+ raise ValueError, _("No valid delegatee references found")
+ else:
+ crefs += self.get_delegated_to()
+
+ self.setDelegatedTo(list(set(crefs)))
+
+ def get_cutype(self):
+ return self.cutype()
+
+ def get_delegated_from(self):
+ return self.delegatedFrom()
+
+ def get_delegated_to(self):
+ return self.delegatedTo()
+
def get_email(self):
return self.contactreference.get_email()
@@ -77,6 +124,12 @@ class Attendee(kolabformat.Attendee):
def get_participant_status(self):
return self.partStat()
+ def get_role(self):
+ return self.role()
+
+ def get_rsvp(self):
+ return self.rsvp()
+
def set_cutype(self, cutype):
if cutype in self.cutype_map.keys():
self.setCutype(self.cutype_map[cutype])