1.1 --- a/imipweb/resource.py Sat Sep 26 17:39:20 2015 +0200
1.2 +++ b/imipweb/resource.py Sat Sep 26 18:59:47 2015 +0200
1.3 @@ -125,11 +125,11 @@
1.4 else:
1.5 return parts[:2]
1.6
1.7 - def _get_object(self, uid, recurrenceid=None, section=None):
1.8 - if self.objects.has_key((uid, recurrenceid, section)):
1.9 - return self.objects[(uid, recurrenceid, section)]
1.10 + def _get_object(self, uid, recurrenceid=None, section=None, username=None):
1.11 + if self.objects.has_key((uid, recurrenceid, section, username)):
1.12 + return self.objects[(uid, recurrenceid, section, username)]
1.13
1.14 - obj = self.objects[(uid, recurrenceid, section)] = self.get_stored_object(uid, recurrenceid, section)
1.15 + obj = self.objects[(uid, recurrenceid, section, username)] = self.get_stored_object(uid, recurrenceid, section, username)
1.16 return obj
1.17
1.18 def _get_recurrences(self, uid):
1.19 @@ -156,15 +156,27 @@
1.20 summary = []
1.21
1.22 for uid, recurrenceid, request_type in self._get_requests():
1.23 - obj = self.get_stored_object(uid, recurrenceid)
1.24 - if obj:
1.25 - recurrenceids = self._get_active_recurrences(uid)
1.26 +
1.27 + # Obtain either normal objects or counter-proposals.
1.28 +
1.29 + if not request_type:
1.30 + objs = [self._get_object(uid, recurrenceid)]
1.31 + elif request_type == "COUNTER":
1.32 + objs = []
1.33 + for attendee in self.store.get_counters(self.user, uid, recurrenceid):
1.34 + objs.append(self._get_object(uid, recurrenceid, "counters", attendee))
1.35
1.36 - # Obtain only active periods, not those replaced by redefined
1.37 - # recurrences, converting to free/busy periods.
1.38 + # For each object, obtain the periods involved.
1.39 +
1.40 + for obj in objs:
1.41 + if obj:
1.42 + recurrenceids = self._get_active_recurrences(uid)
1.43
1.44 - for p in obj.get_active_periods(recurrenceids, self.get_tzid(), self.get_window_end()):
1.45 - summary.append(obj.get_freebusy_period(p))
1.46 + # Obtain only active periods, not those replaced by redefined
1.47 + # recurrences, converting to free/busy periods.
1.48 +
1.49 + for p in obj.get_active_periods(recurrenceids, self.get_tzid(), self.get_window_end()):
1.50 + summary.append(obj.get_freebusy_period(p))
1.51
1.52 return summary
1.53