1.1 --- a/imiptools/handlers/person.py Thu Feb 05 22:22:41 2015 +0100
1.2 +++ b/imiptools/handlers/person.py Thu Feb 05 22:35:48 2015 +0100
1.3 @@ -20,7 +20,7 @@
1.4 """
1.5
1.6 from imiptools.content import Handler
1.7 -from imiptools.data import get_address, get_uri, uri_dict, uri_items
1.8 +from imiptools.data import get_uri
1.9 from imiptools.handlers.common import CommonFreebusy
1.10 from imiptools.profile import Preferences
1.11
1.12 @@ -28,7 +28,7 @@
1.13
1.14 "Handling mechanisms specific to people."
1.15
1.16 - def _record_and_deliver(self, from_organiser=True, queue=False, cancel=False):
1.17 + def _record(self, from_organiser=True, queue=False, cancel=False):
1.18
1.19 oa = self.require_organiser_and_attendees(from_organiser)
1.20 if not oa:
1.21 @@ -79,7 +79,12 @@
1.22
1.23 "Record free/busy information for the received information."
1.24
1.25 - senders = self.obj.get_items(from_organiser and "ORGANIZER" or "ATTENDEE")
1.26 + oa = self.require_organiser_and_attendees(from_organiser)
1.27 + if not oa:
1.28 + return
1.29 +
1.30 + organiser_item, attendees = oa
1.31 + senders = from_organiser and [organiser_item] or attendees
1.32
1.33 if not senders:
1.34 return
1.35 @@ -96,7 +101,7 @@
1.36 except ValueError:
1.37 pass
1.38
1.39 - for sender, sender_attr in uri_items(senders):
1.40 + for sender, sender_attr in senders:
1.41 self.store.set_freebusy_for_other(get_uri(self.recipient), freebusy, sender)
1.42
1.43 class Event(PersonHandler):
1.44 @@ -113,7 +118,7 @@
1.45
1.46 "Queue a cancellation of any active event."
1.47
1.48 - self._record_and_deliver(from_organiser=True, queue=False, cancel=True)
1.49 + self._record(from_organiser=True, queue=False, cancel=True)
1.50 return self.wrap("A cancellation has been received.", link=False)
1.51
1.52 def counter(self):
1.53 @@ -132,28 +137,28 @@
1.54
1.55 "Register details of any relevant event."
1.56
1.57 - self._record_and_deliver(from_organiser=True, queue=False)
1.58 + self._record(from_organiser=True, queue=False)
1.59 return self.wrap("Details of an event have been received.")
1.60
1.61 def refresh(self):
1.62
1.63 "Update details of any active event."
1.64
1.65 - self._record_and_deliver(from_organiser=True, queue=False)
1.66 + self._record(from_organiser=True, queue=False)
1.67 return self.wrap("An event update has been received.")
1.68
1.69 def reply(self):
1.70
1.71 "Record replies and notify the recipient."
1.72
1.73 - self._record_and_deliver(from_organiser=False, queue=False)
1.74 + self._record(from_organiser=False, queue=False)
1.75 return self.wrap("A reply has been received.")
1.76
1.77 def request(self):
1.78
1.79 "Hold requests and notify the recipient."
1.80
1.81 - self._record_and_deliver(from_organiser=True, queue=True)
1.82 + self._record(from_organiser=True, queue=True)
1.83 return self.wrap("A request has been received.")
1.84
1.85 class Freebusy(PersonHandler, CommonFreebusy):
1.86 @@ -217,7 +222,7 @@
1.87
1.88 # NOTE: Register details of any relevant entry.
1.89
1.90 - self._record_and_deliver(from_organiser=True, queue=False)
1.91 + self._record(from_organiser=True, queue=False)
1.92 return self.wrap("Details of a journal entry have been received.")
1.93
1.94 class Todo(PersonHandler):
1.95 @@ -252,28 +257,28 @@
1.96
1.97 "Register details of any relevant item."
1.98
1.99 - self._record_and_deliver(from_organiser=True, queue=False)
1.100 + self._record(from_organiser=True, queue=False)
1.101 return self.wrap("Details of an item have been received.")
1.102
1.103 def refresh(self):
1.104
1.105 "Update details of any active item."
1.106
1.107 - self._record_and_deliver(from_organiser=True, queue=False)
1.108 + self._record(from_organiser=True, queue=False)
1.109 return self.wrap("An item update has been received.")
1.110
1.111 def reply(self):
1.112
1.113 "Record replies and notify the recipient."
1.114
1.115 - self._record_and_deliver(from_organiser=False, queue=False)
1.116 + self._record(from_organiser=False, queue=False)
1.117 return self.wrap("A reply has been received.")
1.118
1.119 def request(self):
1.120
1.121 "Hold requests and notify the recipient."
1.122
1.123 - self._record_and_deliver(from_organiser=True, queue=True)
1.124 + self._record(from_organiser=True, queue=True)
1.125 return self.wrap("A request has been received.")
1.126
1.127 # Handler registry.