mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-24 07:06:41 +00:00
SafeConfigParser has been replaced by ConfigParser.
This commit is contained in:
parent
c76afc9ece
commit
1a7bb06587
@ -184,7 +184,7 @@ def read_config(basedir, portnumfile, generated_files=[], _valid_config=None):
|
|||||||
|
|
||||||
# (try to) read the main config file
|
# (try to) read the main config file
|
||||||
config_fname = os.path.join(basedir, "tahoe.cfg")
|
config_fname = os.path.join(basedir, "tahoe.cfg")
|
||||||
parser = configparser.SafeConfigParser()
|
parser = configparser.ConfigParser()
|
||||||
try:
|
try:
|
||||||
parser = configutil.get_config(config_fname)
|
parser = configutil.get_config(config_fname)
|
||||||
except EnvironmentError as e:
|
except EnvironmentError as e:
|
||||||
@ -207,7 +207,7 @@ def config_from_string(basedir, portnumfile, config_str, _valid_config=None):
|
|||||||
_valid_config = _common_valid_config()
|
_valid_config = _common_valid_config()
|
||||||
|
|
||||||
# load configuration from in-memory string
|
# load configuration from in-memory string
|
||||||
parser = configparser.SafeConfigParser()
|
parser = configparser.ConfigParser()
|
||||||
if isinstance(config_str, bytes):
|
if isinstance(config_str, bytes):
|
||||||
config_str = config_str.decode("utf-8")
|
config_str = config_str.decode("utf-8")
|
||||||
parser.read_string(config_str)
|
parser.read_string(config_str)
|
||||||
|
@ -16,7 +16,7 @@ if PY2:
|
|||||||
|
|
||||||
# On Python 2 we use the backport package; that means we always get unicode
|
# On Python 2 we use the backport package; that means we always get unicode
|
||||||
# out.
|
# out.
|
||||||
from configparser import SafeConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
|
|
||||||
@ -30,11 +30,11 @@ class UnknownConfigError(Exception):
|
|||||||
|
|
||||||
|
|
||||||
def get_config(tahoe_cfg):
|
def get_config(tahoe_cfg):
|
||||||
"""Load the config, returning a SafeConfigParser.
|
"""Load the config, returning a ConfigParser.
|
||||||
|
|
||||||
Configuration is returned as native strings.
|
Configuration is returned as native strings.
|
||||||
"""
|
"""
|
||||||
config = SafeConfigParser(strict=False)
|
config = ConfigParser(strict=False)
|
||||||
# Byte Order Mark is an optional garbage byte you sometimes get at the
|
# Byte Order Mark is an optional garbage byte you sometimes get at the
|
||||||
# start of UTF-8 encoded files. Especially on Windows. Skip it by using
|
# start of UTF-8 encoded files. Especially on Windows. Skip it by using
|
||||||
# utf-8-sig. https://en.wikipedia.org/wiki/Byte_order_mark
|
# utf-8-sig. https://en.wikipedia.org/wiki/Byte_order_mark
|
||||||
|
Loading…
Reference in New Issue
Block a user