Merge pull request #42 from carloshanson/add-location

Add location
pull/43/head
Thomas Irgang 2019-01-24 08:32:51 +01:00 zatwierdzone przez GitHub
commit 1d169f5dcf
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 14 dodań i 2 usunięć

Wyświetl plik

@ -41,6 +41,7 @@ class Event:
self.end = None
self.all_day = True
self.recurring = False
self.location = None
def time_left(self, time=now()):
"""
@ -115,6 +116,7 @@ class Event:
ne.all_day = self.all_day
ne.recurring = self.recurring
ne.location = self.location
ne.uid = uid
return ne
@ -140,11 +142,21 @@ def create_event(component, tz=UTC):
else: # compute implicit end as start + 0
event.end = event.start
event.summary = str(component.get('summary'))
event.description = str(component.get('description'))
try:
event.summary = str(component.get('summary'))
except UnicodeEncodeError as e:
event.summary = str(component.get('summary').encode('utf-8'))
try:
event.description = str(component.get('description'))
except UnicodeEncodeError as e:
event.description = str(component.get('description').encode('utf-8'))
event.all_day = type(component.get('dtstart').dt) is date
if component.get('rrule'):
event.recurring = True
try:
event.location = str(component.get('location'))
except UnicodeEncodeError as e:
event.location = str(component.get('location').encode('utf-8'))
return event