Commit 114e54e1 authored by Michal Čihař's avatar Michal Čihař

Use configparser from six

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 6933907a
...@@ -26,7 +26,7 @@ import os ...@@ -26,7 +26,7 @@ import os
import os.path import os.path
import email.utils import email.utils
import re import re
import ConfigParser from six.moves.configparser import RawConfigParser
import hashlib import hashlib
# For some reasons, this fails in PyLint sometimes... # For some reasons, this fails in PyLint sometimes...
# pylint: disable=E0611,F0401 # pylint: disable=E0611,F0401
...@@ -758,7 +758,7 @@ class HgRepository(Repository): ...@@ -758,7 +758,7 @@ class HgRepository(Repository):
""" """
section, option = path.split('.', 1) section, option = path.split('.', 1)
filename = os.path.join(self.path, '.hg', 'hgrc') filename = os.path.join(self.path, '.hg', 'hgrc')
config = ConfigParser.RawConfigParser() config = RawConfigParser()
config.read(filename) config.read(filename)
if config.has_option(section, option): if config.has_option(section, option):
return config.get(section, option).decode('utf-8') return config.get(section, option).decode('utf-8')
...@@ -773,7 +773,7 @@ class HgRepository(Repository): ...@@ -773,7 +773,7 @@ class HgRepository(Repository):
value = value.encode('utf-8') value = value.encode('utf-8')
section = section.encode('utf-8') section = section.encode('utf-8')
option = option.encode('utf-8') option = option.encode('utf-8')
config = ConfigParser.RawConfigParser() config = RawConfigParser()
config.read(filename) config.read(filename)
if not config.has_section(section): if not config.has_section(section):
config.add_section(section) config.add_section(section)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment