]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/python | |
2 | ||
3 | import psycopg.adapt | |
4 | ||
5 | class Object(object): | |
6 | def __init__(self, backend, *args, **kwargs): | |
7 | self.backend = backend | |
8 | ||
9 | self.init(*args, **kwargs) | |
10 | ||
11 | def init(self, *args, **kwargs): | |
12 | """ | |
13 | Function for custom initialization. | |
14 | """ | |
15 | pass | |
16 | ||
17 | @property | |
18 | def db(self): | |
19 | return self.backend.db | |
20 | ||
21 | @property | |
22 | def accounts(self): | |
23 | return self.backend.accounts | |
24 | ||
25 | @property | |
26 | def downloads(self): | |
27 | return self.backend.downloads | |
28 | ||
29 | @property | |
30 | def fireinfo(self): | |
31 | return self.backend.fireinfo | |
32 | ||
33 | @property | |
34 | def iuse(self): | |
35 | return self.backend.iuse | |
36 | ||
37 | @property | |
38 | def settings(self): | |
39 | return self.backend.settings | |
40 | ||
41 | ||
42 | # SQL Integration | |
43 | ||
44 | class ObjectDumper(psycopg.adapt.Dumper): | |
45 | def dump(self, obj): | |
46 | # Return the ID (as bytes) | |
47 | return bytes("%s" % obj.id, "utf-8") |