1.1 --- a/imiptools/period.py Wed Mar 04 18:03:35 2015 +0100
1.2 +++ b/imiptools/period.py Thu Mar 05 01:01:44 2015 +0100
1.3 @@ -67,7 +67,7 @@
1.4
1.5 insort_left(freebusy, period)
1.6
1.7 -def remove_period(freebusy, uid, recurrenceid=None):
1.8 +def remove_period(freebusy, uid, recurrenceid=None, remove_all=False):
1.9
1.10 """
1.11 Remove from 'freebusy' all periods associated with 'uid' and 'recurrenceid'
1.12 @@ -77,7 +77,7 @@
1.13 i = 0
1.14 while i < len(freebusy):
1.15 t = freebusy[i]
1.16 - if len(t) >= 5 and t[2] == uid and t[4] == recurrenceid:
1.17 + if len(t) >= 5 and t[2] == uid and (remove_all or t[4] == recurrenceid):
1.18 del freebusy[i]
1.19 else:
1.20 i += 1
1.21 @@ -403,14 +403,14 @@
1.22
1.23 return start, end, uid, recurrenceid, key
1.24
1.25 -def update_freebusy(freebusy, periods, transp, uid, recurrenceid):
1.26 +def update_freebusy(freebusy, periods, transp, uid, recurrenceid, replace_all=False):
1.27
1.28 """
1.29 Update the free/busy details with the given 'periods', 'transp' setting and
1.30 'uid' plus 'recurrenceid'.
1.31 """
1.32
1.33 - remove_period(freebusy, uid, recurrenceid)
1.34 + remove_period(freebusy, uid, recurrenceid, replace_all)
1.35
1.36 for start, end in periods:
1.37 insert_period(freebusy, (start, end, uid, transp, recurrenceid))