better with constructor param
This commit is contained in:
@@ -25,9 +25,10 @@ import pisi.db.lazydb as lazydb
|
||||
|
||||
class ComponentDB(lazydb.LazyDB):
|
||||
|
||||
def init(self):
|
||||
self.cacheable = True
|
||||
def __init__(self):
|
||||
lazydb.LazyDB.__init__(self, cacheable=True)
|
||||
|
||||
def init(self):
|
||||
component_nodes = {}
|
||||
component_packages = {}
|
||||
component_sources = {}
|
||||
|
||||
+3
-2
@@ -22,15 +22,16 @@ class Singleton(object):
|
||||
return type._the_instance
|
||||
|
||||
class LazyDB(Singleton):
|
||||
def __init__(self):
|
||||
def __init__(self, cacheable=False):
|
||||
if not self.__dict__.has_key("initialized"):
|
||||
self.initialized = False
|
||||
self.cacheable = cacheable
|
||||
|
||||
def is_initialized(self):
|
||||
return self.initialized
|
||||
|
||||
def cache_save(self):
|
||||
if os.access("/var/cache/pisi", os.W_OK) and self.__class__._the_instance.__dict__.has_key("cacheable"):
|
||||
if os.access("/var/cache/pisi", os.W_OK) and self.cacheable:
|
||||
cPickle.dump(self.__class__._the_instance.__dict__,
|
||||
file('/var/cache/pisi/%s.cache' % self.__class__.__name__.lower(), 'wb'), 1)
|
||||
|
||||
|
||||
@@ -35,9 +35,10 @@ import pisi.db.lazydb as lazydb
|
||||
|
||||
class PackageDB(lazydb.LazyDB):
|
||||
|
||||
def init(self):
|
||||
self.cacheable = True
|
||||
def __init__(self):
|
||||
lazydb.LazyDB.__init__(self, cacheable=True)
|
||||
|
||||
def init(self):
|
||||
self.__package_nodes = {} # Packages
|
||||
self.__revdeps = {} # Reverse dependencies
|
||||
self.__obsoletes = {} # Obsoletes
|
||||
|
||||
+3
-2
@@ -24,9 +24,10 @@ import pisi.db.lazydb as lazydb
|
||||
|
||||
class SourceDB(lazydb.LazyDB):
|
||||
|
||||
def init(self):
|
||||
self.cacheable = True
|
||||
def __init__(self):
|
||||
lazydb.LazyDB.__init__(self, cacheable=True)
|
||||
|
||||
def init(self):
|
||||
self.__source_nodes = {}
|
||||
self.__pkgstosrc = {}
|
||||
self.__revdeps = {}
|
||||
|
||||
Reference in New Issue
Block a user