tools (config), memory: renamed SafeConfigParser following Python 3 port
This commit is contained in:
parent
155d75bf32
commit
b039dc4572
2 changed files with 6 additions and 6 deletions
|
|
@ -26,7 +26,7 @@ log = getLogger(__name__)
|
|||
import os.path
|
||||
import copy
|
||||
from collections import namedtuple
|
||||
from configparser import SafeConfigParser, NoOptionError, NoSectionError
|
||||
from configparser import ConfigParser, NoOptionError, NoSectionError
|
||||
from uuid import uuid4
|
||||
from twisted.python import failure
|
||||
from twisted.internet import defer, reactor, error
|
||||
|
|
@ -229,7 +229,7 @@ def fixLocalDir(silent=True):
|
|||
|
||||
@param silent (boolean): toggle logging output (must be True when called from sat.sh)
|
||||
"""
|
||||
user_config = SafeConfigParser()
|
||||
user_config = ConfigParser()
|
||||
try:
|
||||
user_config.read(C.CONFIG_FILES)
|
||||
except:
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
import os
|
||||
import csv
|
||||
import json
|
||||
from configparser import SafeConfigParser, DEFAULTSECT, NoOptionError, NoSectionError
|
||||
from configparser import ConfigParser, DEFAULTSECT, NoOptionError, NoSectionError
|
||||
from xdg import BaseDirectory
|
||||
from sat.core.log import getLogger
|
||||
from sat.core.constants import Const as C
|
||||
|
|
@ -42,7 +42,7 @@ def fixConfigOption(section, option, value, silent=True):
|
|||
@param value (str): the new value
|
||||
@param silent (boolean): toggle logging output (must be True when called from sat.sh)
|
||||
"""
|
||||
config = SafeConfigParser()
|
||||
config = ConfigParser()
|
||||
target_file = None
|
||||
for file_ in C.CONFIG_FILES[::-1]:
|
||||
# we will eventually update the existing file with the highest priority,
|
||||
|
|
@ -72,7 +72,7 @@ def fixConfigOption(section, option, value, silent=True):
|
|||
|
||||
def parseMainConf():
|
||||
"""look for main .ini configuration file, and parse it"""
|
||||
config = SafeConfigParser(defaults=C.DEFAULT_CONFIG)
|
||||
config = ConfigParser(defaults=C.DEFAULT_CONFIG)
|
||||
try:
|
||||
config.read(C.CONFIG_FILES)
|
||||
except Exception as e:
|
||||
|
|
@ -83,7 +83,7 @@ def parseMainConf():
|
|||
def getConfig(config, section, name, default=None):
|
||||
"""Get a configuration option
|
||||
|
||||
@param config (SafeConfigParser): the configuration instance
|
||||
@param config (ConfigParser): the configuration instance
|
||||
@param section (str): section of the config file (None or '' for DEFAULT)
|
||||
@param name (str): name of the option
|
||||
@param default: value to use if not found, or Exception to raise an exception
|
||||
|
|
|
|||
Loading…
Reference in a new issue