def _getMasterEventDetails(self, component): """ Logic here comes from RFC4791 Section 9.9 """ start = component.getStartDateUTC() if start is None: return None rulestart = component.propertyValue("DTSTART") end = component.getEndDateUTC() duration = None if end is None: if not start.isDateOnly(): # Timed event with zero duration duration = Duration(days=0) else: # All day event default duration is one day duration = Duration(days=1) end = start + duration else: duration = differenceDateTime(start, end) return ( rulestart, start, end, duration, )
def _addOverrideEventComponent(self, component, limit, got_master): """ Add the specified overridden VEVENT Component to the instance list, replacing the one generated by the master component. @param component: the overridden Component. @param got_master: whether a master component has already been expanded. """ #TODO: This does not take into account THISANDPRIOR - only THISANDFUTURE start = component.getStartDateUTC() if start is None: return end = component.getEndDateUTC() duration = None if end is None: if isinstance(start, datetime.datetime): # Timed event with zero duration duration = datetime.timedelta(days=0) else: # All day event default duration is one day duration = datetime.timedelta(days=1) end = start + duration else: duration = differenceDateTime(start, end) self._addOverrideComponent(component, limit, start, end, got_master)
def _addMasterEventComponent(self, component, limit): """ Add the specified master VEVENT Component to the instance list, expanding it within the supplied time range. @param component: the Component to expand @param limit: the end datetime.datetime for expansion """ start = component.getStartDateUTC() if start is None: return end = component.getEndDateUTC() duration = None if end is None: if isinstance(start, datetime.datetime): # Timed event with zero duration duration = datetime.timedelta(days=0) else: # All day event default duration is one day duration = datetime.timedelta(days=1) end = start + duration else: duration = differenceDateTime(start, end) self._addMasterComponent(component, limit, start, end, duration)
def _getMasterToDoDetails(self, component): """ Logic here comes from RFC4791 Section 9.9 """ dtstart = component.getStartDateUTC() dtend = component.getEndDateUTC() dtdue = component.getDueDateUTC() # DTSTART and DURATION or DUE case if dtstart is not None: rulestart = component.propertyValue("DTSTART") start = dtstart if dtend is not None: end = dtend elif dtdue is not None: end = dtdue else: end = dtstart # DUE case elif dtdue is not None: rulestart = component.propertyValue("DUE") start = end = dtdue # Fall back to COMPLETED or CREATED - cannot be recurring else: rulestart = None from twistedcaldav.ical import maxDateTime, minDateTime dtcreated = component.getCreatedDateUTC() dtcompleted = component.getCompletedDateUTC() if dtcompleted: end = dtcompleted start = dtcreated if dtcreated else end elif dtcreated: start = dtcreated end = maxDateTime else: start = minDateTime end = maxDateTime duration = differenceDateTime(start, end) return ( rulestart, start, end, duration, )
def _getMasterToDoDetails(self, component): """ Logic here comes from RFC4791 Section 9.9 """ dtstart = component.getStartDateUTC() dtend = component.getEndDateUTC() dtdue = component.getDueDateUTC() # DTSTART and DURATION or DUE case if dtstart is not None: rulestart = component.propertyValue("DTSTART") start = dtstart if dtend is not None: end = dtend elif dtdue is not None: end = dtdue else: end = dtstart # DUE case elif dtdue is not None: rulestart = component.propertyValue("DUE") start = end = dtdue # Fall back to COMPLETED or CREATED - cannot be recurring else: rulestart = None from twistedcaldav.ical import maxDateTime, minDateTime dtcreated = component.getCreatedDateUTC() dtcompleted = component.getCompletedDateUTC() if dtcompleted: end = dtcompleted start = dtcreated if dtcreated else end elif dtcreated: start = dtcreated end = maxDateTime else: start = minDateTime end = maxDateTime duration = differenceDateTime(start, end) return (rulestart, start, end, duration,)
def _addMasterToDoComponent(self, component, limit): """ Add the specified master VTODO Component to the instance list, expanding it within the supplied time range. @param component: the Component to expand @param limit: the end datetime.datetime for expansion """ start = component.getStartDateUTC() due = component.getDueDateUTC() if start is None and due is None: return if start is None: start = due elif due is None: due = start duration = differenceDateTime(start, due) self._addMasterComponent(component, limit, start, due, duration)
def _getMasterEventDetails(self, component): """ Logic here comes from RFC4791 Section 9.9 """ start = component.getStartDateUTC() if start is None: return None rulestart = component.propertyValue("DTSTART") end = component.getEndDateUTC() duration = None if end is None: if not start.isDateOnly(): # Timed event with zero duration duration = PyCalendarDuration(days=0) else: # All day event default duration is one day duration = PyCalendarDuration(days=1) end = start + duration else: duration = differenceDateTime(start, end) return (rulestart, start, end, duration,)