Moved multi-day identifier to event properties
This commit is contained in:
parent
25f2288bdd
commit
39fa0bce21
3 changed files with 14 additions and 12 deletions
|
@ -5,6 +5,7 @@ class CalendarEvent (object):
|
|||
self.end_datetime = None
|
||||
self.duration = None
|
||||
self.allday = None
|
||||
self.multiday = None
|
||||
self.rrule = None
|
||||
|
||||
self.title = None
|
||||
|
|
|
@ -51,6 +51,7 @@ class IcalEvents(CalendarInterface):
|
|||
cal_event.description = event.description
|
||||
cal_event.location = event.location
|
||||
cal_event.allday = event.all_day
|
||||
cal_event.multiday = self.__is_multiday__(cal_event)
|
||||
cal_event.rrule = self.__extract_rrule__(event)
|
||||
|
||||
cal_event.begin_datetime = cal_event.begin_datetime.astimezone(None)
|
||||
|
@ -84,4 +85,12 @@ class IcalEvents(CalendarInterface):
|
|||
if re.search('RRULE',str(event)) is None:
|
||||
return None
|
||||
|
||||
return re.search('RRULE:(.+?)\n',str(event)).group(1).rstrip()
|
||||
return re.search('RRULE:(.+?)\n',str(event)).group(1).rstrip()
|
||||
|
||||
def __is_multiday__ (self, event):
|
||||
if event.allday and event.duration == timedelta(1):
|
||||
return False
|
||||
|
||||
return event.begin_datetime.day != event.end_datetime.day or \
|
||||
event.begin_datetime.month != event.end_datetime.month or \
|
||||
event.begin_datetime.year != event.end_datetime.year
|
|
@ -34,7 +34,7 @@ def event_prefix_str_md_dif (event, relative_date=None):
|
|||
if relative_date is None:
|
||||
relative_date = event.begin_datetime.date()
|
||||
|
||||
if __is_multiday__(event) is False:
|
||||
if event.multiday is False:
|
||||
return event_time_summary(event)
|
||||
|
||||
#Relative to
|
||||
|
@ -56,7 +56,7 @@ def event_prefix_str (event, relative_date=None):
|
|||
if relative_date is None:
|
||||
relative_date = event.begin_datetime.date()
|
||||
|
||||
if __is_multiday__(event):
|
||||
if event.multiday:
|
||||
return multiday_detailed
|
||||
else:
|
||||
return event_time_detailed(event)
|
||||
|
@ -65,7 +65,7 @@ def event_prefix_str_sum (event, relative_date=None):
|
|||
if relative_date is None:
|
||||
relative_date = event.begin_datetime.date()
|
||||
|
||||
if __is_multiday__(event):
|
||||
if event.multiday:
|
||||
return multiday_character
|
||||
else:
|
||||
return event_time_summary(event)
|
||||
|
@ -99,14 +99,6 @@ def date_summary_str(dt):
|
|||
else:
|
||||
return dt.strftime('%a ' + day + '. %b')
|
||||
|
||||
def __is_multiday__ (event):
|
||||
if event.allday and event.duration == timedelta(1):
|
||||
return False
|
||||
|
||||
return event.begin_datetime.day != event.end_datetime.day or \
|
||||
event.begin_datetime.month != event.end_datetime.month or \
|
||||
event.begin_datetime.year != event.end_datetime.year
|
||||
|
||||
def __equal__(dt1, dt2):
|
||||
return dt1.day == dt2.day and \
|
||||
dt1.month == dt2.month and \
|
||||
|
|
Loading…
Reference in a new issue