]>
Commit | Line | Data |
---|---|---|
9137135a MT |
1 | #!/usr/bin/python |
2 | ||
3 | ||
4 | class Object(object): | |
5 | """ | |
6 | Main object where all other objects inherit from. | |
7 | ||
8 | This is used to access the global instance of Pakfire | |
9 | and hold the database connection. | |
10 | """ | |
11 | def __init__(self, pakfire): | |
12 | self.pakfire = pakfire | |
13 | ||
14 | # Shortcut to the database. | |
15 | self.db = self.pakfire.db | |
16 | ||
17 | # Shortcut to settings. | |
18 | if hasattr(self.pakfire, "settings"): | |
19 | self.settings = self.pakfire.settings | |
f6e6ff79 | 20 | |
771320fe MT |
21 | # Private cache. |
22 | self._cache = None | |
23 | ||
f6e6ff79 MT |
24 | @property |
25 | def cache(self): | |
26 | """ | |
27 | Shortcut to the cache. | |
28 | """ | |
771320fe MT |
29 | if self._cache: |
30 | return self._cache | |
31 | ||
f6e6ff79 MT |
32 | return self.pakfire.cache |
33 | ||
34 | @property | |
35 | def geoip(self): | |
36 | return self.pakfire.geoip |