Skip to content

Commit

Permalink
fix: fix KeyError on events processing
Browse files Browse the repository at this point in the history
  • Loading branch information
Jérôme Deuchnord authored and Deuchnord committed Nov 9, 2021
1 parent 1c66889 commit be6bf53
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions _kosmorro/dumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,16 @@ def to_string(self):
text.append(self.get_moon(self.moon_phase))

if len(self.events) > 0:
text.append(
"\n".join(
[
self.style(_("Expected events:"), "h2"),
self.get_events(self.events),
]
events = self.get_events(self.events)
if events.strip("\n") != "":
text.append(
"\n".join(
[
self.style(_("Expected events:"), "h2"),
events,
]
)
)
)

if self.timezone == 0:
text.append(self.style(_("Note: All the hours are given in UTC."), "em"))
Expand Down Expand Up @@ -212,6 +214,9 @@ def get_events(self, events: [Event]) -> str:

for event in events:
description = strings.from_event(event)
if description is None:
continue

time_fmt = (
TIME_FORMAT
if event.start_time.day == self.date.day
Expand Down

0 comments on commit be6bf53

Please sign in to comment.