core: removed default_config:

- constants in core.default_config moved to core.constants
    - removed unused host.getConst and host.setConst
    - APP_NAME* used where it make sense
This commit is contained in:
Goffi 2014-03-22 17:48:10 +01:00
commit 6d768028d1

View file

@ -28,7 +28,6 @@ from twisted.internet import defer, reactor
from twisted.words.protocols.jabber import jid
from sat.core import exceptions
from sat.core.constants import Const as C
from sat.core.default_config import default_config
from sat.memory.sqlite import SqliteStorage
from sat.memory.persistent import PersistentDict
from sat.memory.params import Params
@ -118,9 +117,7 @@ class Memory(object):
self.server_features = {} # used to store discovery's informations
self.server_identities = {}
self.config = self.parseMainConf()
host.setConst('savefile_database', C.SAVEFILE_DATABASE)
database_file = os.path.expanduser(self.getConfig('', 'local_dir') +
self.host.getConst('savefile_database'))
database_file = os.path.expanduser(os.path.join(self.getConfig('', 'local_dir'), C.SAVEFILE_DATABASE))
self.storage = SqliteStorage(database_file, host.__version__)
PersistentDict.storage = self.storage
self.params = Params(host, self.storage)
@ -133,7 +130,7 @@ class Memory(object):
def parseMainConf(self):
"""look for main .ini configuration file, and parse it"""
_config = SafeConfigParser(defaults=default_config)
_config = SafeConfigParser(defaults=C.DEFAULT_CONFIG)
try:
_config.read(map(os.path.expanduser, ['/etc/sat.conf', '~/sat.conf', '~/.sat.conf', 'sat.conf', '.sat.conf']))
except: