# HG changeset patch # User Paul Boddie # Date 1423158292 -3600 # Node ID 8e4da2be6c7772155aa8b542bf2c8a5a0e310b94 # Parent 963eca78ca5d00b3bcf847bc5d790ef80ac08f80 Replaced the separate accept and decline actions with a single reply action that uses the attendance information submitted in the form. diff -r 963eca78ca5d -r 8e4da2be6c77 imip_manager.py --- a/imip_manager.py Thu Feb 05 18:10:04 2015 +0100 +++ b/imip_manager.py Thu Feb 05 18:44:52 2015 +0100 @@ -164,24 +164,23 @@ # Action methods. - def process_received_request(self, accept, update=False): + def process_received_request(self, update=False): """ - Process the current request for the given 'user', accepting any request - when 'accept' is true, declining requests otherwise. Return whether any + Process the current request for the given 'user'. Return whether any action was taken. If 'update' is given, the sequence number will be incremented in order to override any previous response. """ - # When accepting or declining, do so only on behalf of this user, - # preserving any other attributes set as an attendee. + # Reply only on behalf of this user. for attendee, attendee_attr in self.obj.get_items("ATTENDEE"): if attendee == self.user: - attendee_attr["PARTSTAT"] = accept and "ACCEPTED" or "DECLINED" + if attendee_attr.has_key("RSVP"): + del attendee_attr["RSVP"] if self.messenger and self.messenger.sender != get_address(attendee): attendee_attr["SENT-BY"] = get_uri(self.messenger.sender) self.obj["ATTENDEE"] = [(attendee, attendee_attr)] @@ -485,21 +484,20 @@ # Process any action. - accept = args.has_key("accept") - decline = args.has_key("decline") + reply = args.has_key("reply") discard = args.has_key("discard") invite = args.has_key("invite") cancel = args.has_key("cancel") save = args.has_key("save") update = not queued and args.has_key("update") - if accept or decline or invite or cancel: + if reply or invite or cancel: handler = ManagerHandler(obj, self.user, self.messenger) # Process the object and remove it from the list of requests. - if (accept or decline) and handler.process_received_request(accept, update) or \ + if reply and handler.process_received_request(update) or \ (invite or cancel) and handler.process_created_request(invite and "REQUEST" or "CANCEL", update): self.remove_request(uid) @@ -551,11 +549,7 @@ if is_attendee and not is_organiser: partstat = attendee_attr.get("PARTSTAT") - if partstat == "ACCEPTED": - page.p("This request has been accepted.") - elif partstat == "DECLINED": - page.p("This request has been declined.") - else: + if not partstat: page.p("This request has not yet been dealt with.") if needs_update: @@ -564,9 +558,7 @@ page.p("An action is required for this request:") page.p() - page.input(name="accept", type="submit", value="Accept") - page.add(" ") - page.input(name="decline", type="submit", value="Decline") + page.input(name="reply", type="submit", value="Reply") page.add(" ") page.input(name="discard", type="submit", value="Discard") page.p.close()