1.1 --- a/imiptools/handlers/resource.py Sun Oct 26 22:21:56 2014 +0100
1.2 +++ b/imiptools/handlers/resource.py Sun Oct 26 23:10:12 2014 +0100
1.3 @@ -4,11 +4,9 @@
1.4 Handlers for a resource.
1.5 """
1.6
1.7 -from datetime import date, datetime, timedelta
1.8 from imiptools.content import Handler, format_datetime, to_part
1.9 from imiptools.period import have_conflict, insert_period, remove_period
1.10 from vCalendar import to_node
1.11 -from vRecurrence import get_parameters, get_rule
1.12
1.13 class Event(Handler):
1.14
1.15 @@ -76,36 +74,7 @@
1.16 # If newer than any old version, discard old details from the
1.17 # free/busy record and check for suitability.
1.18
1.19 - dtstart = self.get_utc_datetime("DTSTART")
1.20 - dtend = self.get_utc_datetime("DTEND")
1.21 -
1.22 - # NOTE: Need also DURATION support.
1.23 -
1.24 - duration = dtend - dtstart
1.25 -
1.26 - # Recurrence rules create multiple instances to be checked.
1.27 - # Conflicts may only be assessed within a period defined by policy
1.28 - # for the agent, with instances outside that period being considered
1.29 - # unchecked.
1.30 -
1.31 - # NOTE: Need to expose the 100 day window in the configuration.
1.32 -
1.33 - window_end = datetime.now() + timedelta(100)
1.34 -
1.35 - # NOTE: Need also RDATE and EXDATE support.
1.36 -
1.37 - rrule = self.get_value("RRULE")
1.38 -
1.39 - if rrule:
1.40 - selector = get_rule(dtstart, rrule)
1.41 - parameters = get_parameters(rrule)
1.42 - periods = []
1.43 - for start in selector.materialise(dtstart, window_end, parameters.get("COUNT"), parameters.get("BYSETPOS")):
1.44 - start = datetime(*start, tzinfo=timezone("UTC"))
1.45 - end = start + duration
1.46 - periods.append((format_datetime(start), format_datetime(end)))
1.47 - else:
1.48 - periods = [(format_datetime(dtstart), format_datetime(dtend))]
1.49 + periods = self.get_periods()
1.50
1.51 conflict = False
1.52 freebusy = self.store.get_freebusy(attendee) or []