]> git.ipfire.org Git - ipfire.org.git/blame - src/backend/misc.py
wiki: Only match usernames when a word starts with @
[ipfire.org.git] / src / backend / misc.py
CommitLineData
940227cb
MT
1#!/usr/bin/python
2
3082f0e9
MT
3import psycopg.adapt
4
a6dc0bad 5class Object(object):
0a6875dc 6 def __init__(self, backend, *args, **kwargs):
a6dc0bad
MT
7 self.backend = backend
8
0a6875dc 9 self.init(*args, **kwargs)
9068dba1 10
0a6875dc 11 def init(self, *args, **kwargs):
9068dba1
MT
12 """
13 Function for custom initialization.
14 """
15 pass
16
a6dc0bad
MT
17 @property
18 def db(self):
19 return self.backend.db
20
21 @property
22 def accounts(self):
23 return self.backend.accounts
24
9068dba1
MT
25 @property
26 def downloads(self):
27 return self.backend.downloads
28
66862195
MT
29 @property
30 def fireinfo(self):
31 return self.backend.fireinfo
32
9068dba1
MT
33 @property
34 def iuse(self):
35 return self.backend.iuse
36
9068dba1
MT
37 @property
38 def settings(self):
39 return self.backend.settings
3082f0e9
MT
40
41
42# SQL Integration
43
44class ObjectDumper(psycopg.adapt.Dumper):
45 def dump(self, obj):
46 # Return the ID (as bytes)
47 return bytes("%s" % obj.id, "utf-8")