diff --git a/combo_plugin_gnm/templatetags/gnm.py b/combo_plugin_gnm/templatetags/gnm.py index d918770..d82c2d0 100644 --- a/combo_plugin_gnm/templatetags/gnm.py +++ b/combo_plugin_gnm/templatetags/gnm.py @@ -279,6 +279,7 @@ def get_mairie_opening_hours(mairie_data): previous_week = base_datetime - datetime.timedelta(7) next_week = base_datetime + datetime.timedelta(7) for specification in mairie_data.get('openinghoursspecification', []): + known_format = True valid_from, valid_through = previous_week, next_week if specification.get('validFrom'): valid_from = parse_valid_from(specification) @@ -304,8 +305,12 @@ def get_mairie_opening_hours(mairie_data): if not (any([x['am'] for x in opening_hours_dict.values()]) or any([x['pm'] for x in opening_hours_dict.values()])): - # always closed, return None to mark unavailability - return None + # always closed, returns None if the format is unknown so it can be + # displayed as "unavailable". + if not known_format: + return None + # otherwise returns an array of closed days + return [(weekday, {'am': None, 'pm': ''}) for weekday in FR_WEEKDAYS] return [ (FR_ABBREV_WEEKDAYS_LIST[weekday], hours) for weekday, hours in opening_hours_dict.items()