Skip to content

Commit

Permalink
Merge pull request #42 from carloshanson/add-location
Browse files Browse the repository at this point in the history
Add location
  • Loading branch information
irgangla authored Jan 24, 2019
2 parents 182aba8 + e26fdc3 commit 1d169f5
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions icalevents/icalparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def __init__(self):
self.end = None
self.all_day = True
self.recurring = False
self.location = None

def time_left(self, time=now()):
"""
Expand Down Expand Up @@ -115,6 +116,7 @@ def copy_to(self, new_start=None, uid=None):

ne.all_day = self.all_day
ne.recurring = self.recurring
ne.location = self.location
ne.uid = uid

return ne
Expand All @@ -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


Expand Down

0 comments on commit 1d169f5

Please sign in to comment.