forked from mswart/openmensa-parsers
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.py
47 lines (36 loc) · 1.15 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import importlib
from utils import ParserNotFound, CanteenPrefixer, ParserRenamer
parsers = {}
def register_parser(parser):
parsers[parser.name] = parser
def parse(request, parser_name, *args):
if parser_name in parsers:
return parsers[parser_name].parse(request, *args)
else:
raise ParserNotFound(parser_name)
for module in [
'aachen',
'darmstadt',
'dresden',
'erlangen_nuernberg',
'halle',
'hamburg',
'hannover',
'karlsruhe',
'leipzig',
'magdeburg',
'muenchen',
'marburg',
'niederbayern_oberpfalz',
'ostniedersachsen',
'siegen',
'wuerzburg',
]:
register_parser(importlib.import_module(module).parser)
register_parser(CanteenPrefixer('braunschweig', 'ostniedersachsen'))
register_parser(ParserRenamer('clausthal', 'ostniedersachsen'))
register_parser(CanteenPrefixer('hildesheim', 'ostniedersachsen'))
register_parser(CanteenPrefixer('suderburg', 'ostniedersachsen'))
register_parser(CanteenPrefixer('wolfenbuettel', 'ostniedersachsen'))
register_parser(CanteenPrefixer('holzminden', 'ostniedersachsen'))
register_parser(CanteenPrefixer('lueneburg', 'ostniedersachsen'))