Make Config and Constants classes singletons
This commit is contained in:
@@ -43,6 +43,8 @@ class Options(object):
|
||||
class Config(object):
|
||||
"""Config Singleton"""
|
||||
|
||||
__metaclass__ = pisi.util.Singleton
|
||||
|
||||
def __init__(self, options = Options()):
|
||||
self.options = options
|
||||
self.values = pisi.configfile.ConfigurationFile("/etc/pisi/pisi.conf")
|
||||
|
||||
@@ -18,6 +18,8 @@ import gettext
|
||||
__trans = gettext.translation('pisi', fallback=True)
|
||||
_ = __trans.ugettext
|
||||
|
||||
from pisi.util import Singleton
|
||||
|
||||
class _constant:
|
||||
"Constant members implementation"
|
||||
class ConstError(TypeError):
|
||||
@@ -38,6 +40,8 @@ class _constant:
|
||||
class Constants:
|
||||
"Pisi Constants Singleton"
|
||||
|
||||
__metaclass__ = Singleton
|
||||
|
||||
__c = _constant()
|
||||
|
||||
def __init__(self):
|
||||
|
||||
Reference in New Issue
Block a user