Merge "Fix SafeConfigParser DeprecationWarning in Python 3.2"
This commit is contained in:
commit
473d360b90
@ -0,0 +1,6 @@
|
||||
|
||||
---
|
||||
fixes:
|
||||
- Since SafeConfigParser is deprecated in Python version 3.2,
|
||||
Trove uses ConfigParser for versions of Python >= 3.2 and
|
||||
SafeConfigParser for earlier versions. (Bug 1618666)
|
@ -19,12 +19,13 @@ import base64
|
||||
import csv
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
|
||||
import six
|
||||
from six.moves.configparser import SafeConfigParser
|
||||
from six.moves import configparser
|
||||
import xmltodict
|
||||
import yaml
|
||||
|
||||
|
||||
from trove.common import utils as trove_utils
|
||||
|
||||
|
||||
@ -227,7 +228,11 @@ class IniCodec(StreamCodec):
|
||||
return buf
|
||||
|
||||
def _init_config_parser(self, sections=None):
|
||||
parser = SafeConfigParser(allow_no_value=True)
|
||||
# SafeConfigParser was deprecated in Python 3.2
|
||||
if sys.version_info >= (3, 2):
|
||||
parser = configparser.ConfigParser(allow_no_value=True)
|
||||
else:
|
||||
parser = configparser.SafeConfigParser(allow_no_value=True)
|
||||
if sections:
|
||||
for section in sections:
|
||||
parser.add_section(section)
|
||||
|
Loading…
Reference in New Issue
Block a user