]>
Commit | Line | Data |
---|---|---|
940227cb MT |
1 | #!/usr/bin/python |
2 | ||
3 | import re | |
4 | ||
5 | from databases import Databases | |
6 | from misc import Singleton | |
7 | ||
8 | class Menu(object): | |
9 | __metaclass__ = Singleton | |
10 | ||
11 | @property | |
12 | def db(self): | |
13 | return Databases().webapp | |
14 | ||
15 | def get(self, host): | |
16 | menu = [] | |
17 | for m in self.db.query("SELECT * FROM menu ORDER BY prio ASC"): | |
18 | try: | |
19 | if not re.match(m.sites, host) is None: | |
20 | menu.append(m) | |
21 | except re.error: | |
22 | # Drop all exceptions that occour when matching the expressions. | |
23 | pass | |
24 | ||
25 | return menu |