1.1 --- a/imiptools/handlers/person_outgoing.py Sat Sep 12 18:15:26 2015 +0200
1.2 +++ b/imiptools/handlers/person_outgoing.py Sat Sep 12 19:58:59 2015 +0200
1.3 @@ -21,7 +21,7 @@
1.4 """
1.5
1.6 from imiptools.client import Client
1.7 -from imiptools.data import uri_dict, uri_item, uri_values
1.8 +from imiptools.data import get_uri, uri_dict, uri_values
1.9 from imiptools.handlers import Handler
1.10 from imiptools.handlers.common import CommonEvent
1.11
1.12 @@ -29,21 +29,23 @@
1.13
1.14 "Handling mechanisms specific to people."
1.15
1.16 - def set_identity(self, from_organiser=True):
1.17 + def set_identity(self, method):
1.18
1.19 """
1.20 - Set the current user for the current object. It is usually set when
1.21 - initialising the handler, using the recipient details, but outgoing
1.22 - messages do not reference the recipient in this way.
1.23 + Set the current user for the current object in the context of the given
1.24 + 'method'. It is usually set when initialising the handler, using the
1.25 + recipient details, but outgoing messages do not reference the recipient
1.26 + in this way.
1.27 """
1.28
1.29 - self.user, attr = uri_item(self.obj.get_item(from_organiser and "ORGANIZER" or "ATTENDEE"))
1.30 + if self.obj:
1.31 + from_organiser = method in self.organiser_methods
1.32 + self.user = get_uri(self.obj.get_value(from_organiser and "ORGANIZER" or "ATTENDEE"))
1.33
1.34 def _add(self):
1.35
1.36 "Add a recurrence for the current object."
1.37
1.38 - self.set_identity()
1.39 if not Client.is_participating(self):
1.40 return False
1.41
1.42 @@ -81,7 +83,6 @@
1.43 from an organiser if 'from_organiser' is set to a true value.
1.44 """
1.45
1.46 - self.set_identity(from_organiser)
1.47 if not Client.is_participating(self):
1.48 return False
1.49
1.50 @@ -128,7 +129,6 @@
1.51 from an organiser if 'from_organiser' is set to a true value.
1.52 """
1.53
1.54 - self.set_identity(True)
1.55 if not Client.is_participating(self):
1.56 return False
1.57