1.1 --- a/imiptools/content.py Sun Mar 01 00:20:17 2015 +0100
1.2 +++ b/imiptools/content.py Sun Mar 01 00:24:11 2015 +0100
1.3 @@ -24,7 +24,7 @@
1.4 from email.mime.text import MIMEText
1.5 from imiptools.config import MANAGER_PATH, MANAGER_URL
1.6 from imiptools.data import Object, parse_object, \
1.7 - get_address, get_uri, get_value, \
1.8 + get_address, get_uri, get_value, get_window_end, \
1.9 is_new_object, uri_dict, uri_item
1.10 from imiptools.dates import format_datetime, to_timezone
1.11 from imiptools.period import can_schedule, insert_period, remove_period, \
1.12 @@ -173,9 +173,12 @@
1.13 def remove_from_freebusy_for_other(self, freebusy, user, other):
1.14 remove_from_freebusy_for_other(freebusy, user, other, self.uid, self.recurrenceid, self.store)
1.15
1.16 - def update_freebusy(self, freebusy, attendee, periods):
1.17 + def _update_freebusy(self, freebusy, attendee, periods, recurrenceid):
1.18 update_freebusy(freebusy, attendee, periods, self.obj.get_value("TRANSP"),
1.19 - self.uid, self.recurrenceid, self.store)
1.20 + self.uid, recurrenceid, self.store)
1.21 +
1.22 + def update_freebusy(self, freebusy, attendee, periods):
1.23 + self._update_freebusy(freebusy, attendee, periods, self.recurrenceid)
1.24
1.25 def update_freebusy_from_participant(self, user, participant_item):
1.26
1.27 @@ -190,9 +193,11 @@
1.28 if participant != user:
1.29 freebusy = self.store.get_freebusy_for_other(user, participant)
1.30
1.31 + window_end = get_window_end(tzid=None)
1.32 +
1.33 if participant_attr.get("PARTSTAT") != "DECLINED":
1.34 update_freebusy_for_other(freebusy, user, participant,
1.35 - self.obj.get_periods_for_freebusy(tzid=None),
1.36 + self.obj.get_periods_for_freebusy(tzid=None, end=window_end),
1.37 self.obj.get_value("TRANSP"),
1.38 self.uid, self.recurrenceid, self.store)
1.39 else:
1.40 @@ -330,15 +335,32 @@
1.41
1.42 return senders
1.43
1.44 + def _get_object(self, user, uid, recurrenceid):
1.45 +
1.46 + """
1.47 + Return the stored object for the given 'user', 'uid' and 'recurrenceid'.
1.48 + """
1.49 +
1.50 + fragment = self.store.get_event(user, uid, recurrenceid)
1.51 + return fragment and Object(fragment)
1.52 +
1.53 def get_object(self, user):
1.54
1.55 """
1.56 Return the stored object to which the current object refers for the
1.57 - given 'user' and for the given 'objtype'.
1.58 + given 'user'.
1.59 """
1.60
1.61 - fragment = self.store.get_event(user, self.uid, self.recurrenceid)
1.62 - return fragment and Object(fragment)
1.63 + return self._get_object(user, self.uid, self.recurrenceid)
1.64 +
1.65 + def get_parent_object(self, user):
1.66 +
1.67 + """
1.68 + Return the parent object to which the current object refers for the
1.69 + given 'user'.
1.70 + """
1.71 +
1.72 + return self._get_object(user, self.uid, None)
1.73
1.74 def have_new_object(self, attendee, obj=None):
1.75