]>
Commit | Line | Data |
---|---|---|
940227cb MT |
1 | #!/usr/bin/python |
2 | ||
3082f0e9 MT |
3 | import psycopg.adapt |
4 | ||
a6dc0bad | 5 | class 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 | ||
e28b082e MT |
37 | @property |
38 | def memcache(self): | |
39 | return self.backend.memcache | |
40 | ||
9068dba1 MT |
41 | @property |
42 | def settings(self): | |
43 | return self.backend.settings | |
3082f0e9 MT |
44 | |
45 | ||
46 | # SQL Integration | |
47 | ||
48 | class ObjectDumper(psycopg.adapt.Dumper): | |
49 | def dump(self, obj): | |
50 | # Return the ID (as bytes) | |
51 | return bytes("%s" % obj.id, "utf-8") |