templatetags: add 'r' prefix to regex strings (#48919)
This commit is contained in:
parent
1ece478eb9
commit
226207a916
|
@ -180,7 +180,7 @@ def get_slots_from_mdr_format(data, today):
|
|||
if not hours:
|
||||
continue
|
||||
try:
|
||||
parts = re.match('(\d?\d)h(\d\d)-(\d?\d)h(\d\d)', hours).groups()
|
||||
parts = re.match(r'(\d?\d)h(\d\d)-(\d?\d)h(\d\d)', hours).groups()
|
||||
except AttributeError:
|
||||
continue
|
||||
# add to slots the opening hours in chronological order beginning from today
|
||||
|
@ -207,13 +207,13 @@ def parse_opening_hours_data(mairie_data):
|
|||
for openinghours in mairie_data.get('openinghours', []):
|
||||
# format is comma-separated days and/or intervals, or only one day
|
||||
try:
|
||||
groups = re.match('(\w\w(?:(?:,|\-)?\w\w)*) (\d\d?):(\d\d?)-(\d\d?):(\d\d?)', openinghours).groups()
|
||||
groups = re.match(r'(\w\w(?:(?:,|\-)?\w\w)*) (\d\d?):(\d\d?)-(\d\d?):(\d\d?)', openinghours).groups()
|
||||
except AttributeError: # invalid input data
|
||||
continue
|
||||
for day in groups[0].split(','):
|
||||
if '-' in day:
|
||||
# interval
|
||||
parts = re.match('(\w\w)-(\w\w)', day).groups() + groups[1:]
|
||||
parts = re.match(r'(\w\w)-(\w\w)', day).groups() + groups[1:]
|
||||
time_table = dict(zip(('start_day', 'end_day', 'start_hour', 'start_minute', 'end_hour', 'end_minute'), parts))
|
||||
days_list = EN_ABBREV_WEEKDAYS_LIST[
|
||||
EN_ABBREV_WEEKDAYS_LIST.index(time_table['start_day'].lower()):
|
||||
|
|
Loading…
Reference in New Issue