1.1 --- a/imiptools/handlers/resource.py Thu May 12 23:15:18 2016 +0200
1.2 +++ b/imiptools/handlers/resource.py Fri May 13 00:22:56 2016 +0200
1.3 @@ -90,7 +90,7 @@
1.4 "Attempt to schedule the current object for the current user."
1.5
1.6 attendee_attr = uri_dict(self.obj.get_value_map("ATTENDEE"))[self.user]
1.7 - delegate = None
1.8 + delegates = None
1.9
1.10 # Attempt to schedule the event.
1.11
1.12 @@ -124,7 +124,7 @@
1.13 if scheduled == "ACCEPTED":
1.14 self.confirm_scheduling()
1.15
1.16 - # For delegated proposals, prepare a request to the delegate in
1.17 + # For delegated proposals, prepare a request to the delegates in
1.18 # addition to the usual response.
1.19
1.20 elif scheduled == "DELEGATED":
1.21 @@ -134,8 +134,7 @@
1.22 # The recipient will have indicated the delegate whose details
1.23 # will have been added to the object.
1.24
1.25 - delegated_to = attendee_attr["DELEGATED-TO"]
1.26 - delegate = delegated_to and delegated_to[0]
1.27 + delegates = attendee_attr["DELEGATED-TO"]
1.28
1.29 # For countered proposals, record the offer in the resource's
1.30 # free/busy collection.
1.31 @@ -169,21 +168,23 @@
1.32 self.update_sender(attendee_attr)
1.33 attendees = [(self.user, attendee_attr)]
1.34
1.35 - # Add the delegate if delegating (RFC 5546 being inconsistent here since
1.36 + # Add delegates if delegating (RFC 5546 being inconsistent here since
1.37 # it provides an example reply to the organiser without the delegate).
1.38
1.39 - if delegate:
1.40 - delegate_attr = uri_dict(self.obj.get_value_map("ATTENDEE"))[delegate]
1.41 - attendees.append((delegate, delegate_attr))
1.42 + if delegates:
1.43 + for delegate in delegates:
1.44 + delegate_attr = uri_dict(self.obj.get_value_map("ATTENDEE"))[delegate]
1.45 + attendees.append((delegate, delegate_attr))
1.46
1.47 # Reply to the delegator in addition to the organiser if replying to a
1.48 # delegation request.
1.49
1.50 - delegator = self.is_delegation()
1.51 - if delegator:
1.52 - delegator_attr = uri_dict(self.obj.get_value_map("ATTENDEE"))[delegator]
1.53 - attendees.append((delegator, delegator_attr))
1.54 - recipients.append(get_address(delegator))
1.55 + delegators = self.is_delegation()
1.56 + if delegators:
1.57 + for delegator in delegators:
1.58 + delegator_attr = uri_dict(self.obj.get_value_map("ATTENDEE"))[delegator]
1.59 + attendees.append((delegator, delegator_attr))
1.60 + recipients.append(get_address(delegator))
1.61
1.62 # Prepare the response for the organiser plus any delegator.
1.63
1.64 @@ -191,11 +192,11 @@
1.65 self.update_dtstamp()
1.66 self.add_result(method, recipients, self.object_to_part(method, self.obj))
1.67
1.68 - # If delegating, send a request to the delegate.
1.69 + # If delegating, send a request to the delegates.
1.70
1.71 - if delegate:
1.72 + if delegates:
1.73 method = "REQUEST"
1.74 - self.add_result(method, [get_address(delegate)], self.object_to_part(method, self.obj))
1.75 + self.add_result(method, map(get_address, delegates), self.object_to_part(method, self.obj))
1.76
1.77 def _cancel_for_attendee(self):
1.78