1.1 --- a/imiptools/content.py Mon Feb 02 00:12:53 2015 +0100
1.2 +++ b/imiptools/content.py Mon Feb 02 00:39:05 2015 +0100
1.3 @@ -133,13 +133,13 @@
1.4
1.5 # Handler mechanism objects.
1.6
1.7 -def handle_itip_part(part, senders, recipient, handlers, messenger):
1.8 +def handle_itip_part(part, handlers):
1.9
1.10 """
1.11 - Handle the given iTIP 'part' from the given 'senders' for the given
1.12 - 'recipient' using the given 'handlers' and information provided by the
1.13 - given 'messenger'. Return a list of responses, each response being a tuple
1.14 - of the form (outgoing-recipients, message-part).
1.15 + Handle the given iTIP 'part' using the given 'handlers'.
1.16 +
1.17 + Return a list of responses, each response being a tuple of the form
1.18 + (outgoing-recipients, message-part).
1.19 """
1.20
1.21 method = part.get_param("method")
1.22 @@ -163,12 +163,12 @@
1.23
1.24 all_results = []
1.25
1.26 - for name, cls in handlers:
1.27 + for name, handler in handlers:
1.28 for fragment in get_fragments(itip, name):
1.29
1.30 # Dispatch to a handler and obtain any response.
1.31
1.32 - handler = cls(Object(fragment), senders, recipient, messenger)
1.33 + handler.set_object(Object(fragment))
1.34 results = methods[method](handler)()
1.35
1.36 # Aggregate responses for a single message.
1.37 @@ -195,14 +195,14 @@
1.38
1.39 "General handler support."
1.40
1.41 - def __init__(self, obj, senders=None, recipient=None, messenger=None):
1.42 + def __init__(self, senders=None, recipient=None, messenger=None):
1.43
1.44 """
1.45 Initialise the handler with the calendar 'obj' and the 'senders' and
1.46 'recipient' of the object (if specifically indicated).
1.47 """
1.48
1.49 - self.obj = obj
1.50 + self.obj = None
1.51 self.senders = senders and set(map(get_address, senders))
1.52 self.recipient = recipient and get_address(recipient)
1.53 self.messenger = messenger
1.54 @@ -218,6 +218,9 @@
1.55 except OSError:
1.56 self.publisher = None
1.57
1.58 + def set_object(self, obj):
1.59 + self.obj = obj
1.60 +
1.61 def wrap(self, text, link=True):
1.62
1.63 "Wrap any valid message for passing to the recipient."