Changeset View
Changeset View
Standalone View
Standalone View
pykolab/xml/event.py
Show First 20 Lines • Show All 874 Lines • ▼ Show 20 Lines | def set_from_ical(self, attr, value): | ||||
params = value.params if hasattr(value, 'params') else {} | params = value.params if hasattr(value, 'params') else {} | ||||
if isinstance(value, icalendar.vDDDTypes) and hasattr(value, 'dt'): | if isinstance(value, icalendar.vDDDTypes) and hasattr(value, 'dt'): | ||||
value = value.dt | value = value.dt | ||||
if attr == "categories": | if attr == "categories": | ||||
self.add_category(value) | self.add_category(value) | ||||
elif attr == "class": | elif attr == "class": | ||||
if (value and value[:2] not in ['X-', 'x-']): | |||||
self.set_classification(value) | self.set_classification(value) | ||||
elif attr == "recurrenceid": | elif attr == "recurrenceid": | ||||
self.set_ical_recurrenceid(value, params) | self.set_ical_recurrenceid(value, params) | ||||
elif hasattr(self, ical_setter): | elif hasattr(self, ical_setter): | ||||
getattr(self, ical_setter)(value) | getattr(self, ical_setter)(value) | ||||
elif hasattr(self, default_setter): | elif hasattr(self, default_setter): | ||||
getattr(self, default_setter)(value) | getattr(self, default_setter)(value) | ||||
def set_ical_attendee(self, _attendee): | def set_ical_attendee(self, _attendee): | ||||
▲ Show 20 Lines • Show All 478 Lines • ▼ Show 20 Lines | def to_event_cal(self): | ||||
from kolab.calendaring import EventCal | from kolab.calendaring import EventCal | ||||
return EventCal(self.event) | return EventCal(self.event) | ||||
def get_next_occurence(self, _datetime): | def get_next_occurence(self, _datetime): | ||||
if not hasattr(self, 'eventcal'): | if not hasattr(self, 'eventcal'): | ||||
self.eventcal = self.to_event_cal() | self.eventcal = self.to_event_cal() | ||||
next_cdatetime = self.eventcal.getNextOccurence(xmlutils.to_cdatetime(_datetime, True)) | next_cdatetime = self.eventcal.getNextOccurence(xmlutils.to_cdatetime(_datetime, True)) | ||||
next_datetime = xmlutils.from_cdatetime(next_cdatetime, True) if next_cdatetime is not None else None | next_datetime = xmlutils.from_cdatetime(next_cdatetime, True) if next_cdatetime is not None else None | ||||
Lint: PEP8 E221: multiple spaces before operator | |||||
# cut infinite recurrence at a reasonable point | # cut infinite recurrence at a reasonable point | ||||
if next_datetime and not self.get_last_occurrence() and next_datetime > xmlutils.to_dt(self._recurrence_end()): | if next_datetime and not self.get_last_occurrence() and next_datetime > xmlutils.to_dt(self._recurrence_end()): | ||||
next_datetime = None | next_datetime = None | ||||
# next_datetime is always a cdatetime, convert to date if necessary | # next_datetime is always a cdatetime, convert to date if necessary | ||||
if next_datetime and not isinstance(self.get_start(), datetime.datetime): | if next_datetime and not isinstance(self.get_start(), datetime.datetime): | ||||
next_datetime = datetime.date(next_datetime.year, next_datetime.month, next_datetime.day) | next_datetime = datetime.date(next_datetime.year, next_datetime.month, next_datetime.day) | ||||
▲ Show 20 Lines • Show All 123 Lines • Show Last 20 Lines |
multiple spaces before operator