]> git.ipfire.org Git - people/jschlag/pbs.git/blob - backend/base.py
Drop dependency on textile
[people/jschlag/pbs.git] / backend / base.py
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
20
21 # Private cache.
22 self._cache = None
23
24 @property
25 def cache(self):
26 """
27 Shortcut to the cache.
28 """
29 if self._cache:
30 return self._cache
31
32 return self.pakfire.cache
33
34 @property
35 def geoip(self):
36 return self.pakfire.geoip