1.1 --- a/imiptools/period.py Tue Aug 11 23:53:54 2015 +0200
1.2 +++ b/imiptools/period.py Wed Aug 12 18:23:24 2015 +0200
1.3 @@ -196,7 +196,7 @@
1.4
1.5 result = PeriodBase.__cmp__(self, other)
1.6 if result == 0 and isinstance(other, FreeBusyPeriod):
1.7 - return cmp(self.uid, other.uid)
1.8 + return cmp((self.uid, self.recurrenceid), (other.uid, other.recurrenceid))
1.9 else:
1.10 return result
1.11
1.12 @@ -271,7 +271,11 @@
1.13
1.14 "Insert into 'freebusy' the given 'period'."
1.15
1.16 - insort_left(freebusy, period)
1.17 + i = bisect_left(freebusy, period)
1.18 + if i == len(freebusy):
1.19 + freebusy.append(period)
1.20 + elif freebusy[i] != period:
1.21 + freebusy.insert(i, period)
1.22
1.23 def remove_period(freebusy, uid, recurrenceid=None):
1.24