From 653a46850d765ca00a76452c76950ed60ab967d3 Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Mon, 14 Feb 2011 10:57:59 +0000 Subject: syncdaemon: make configparser code work with all supported python versions Signed-off-by: Csaba Henk Signed-off-by: Anand V. Avati BUG: 1570 (geosync related changes) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1570 --- xlators/features/marker/utils/syncdaemon/configinterface.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/xlators/features/marker/utils/syncdaemon/configinterface.py b/xlators/features/marker/utils/syncdaemon/configinterface.py index 269bbde67fc..25a2a526818 100644 --- a/xlators/features/marker/utils/syncdaemon/configinterface.py +++ b/xlators/features/marker/utils/syncdaemon/configinterface.py @@ -1,4 +1,9 @@ -import ConfigParser +try: + import ConfigParser +except ImportError: + # py 3 + import configparser as ConfigParser + DEF_SECT = 'global' @@ -10,17 +15,18 @@ class GConffile(object): else: self.section = DEF_SECT self.path = path - self.config = ConfigParser.RawConfigParser({}, dict) + self.config = ConfigParser.RawConfigParser() self.config.read(path) def update_to(self, dct): for sect in set([DEF_SECT, self.section]): if self.config.has_section(sect): - for k, v in self.config._sections[sect].iteritems(): + for k, v in self.config._sections[sect].items(): if k == '__name__': continue k = k.replace('-', '_') dct[k] = v + def get(self, opt=None): d = {} self.update_to(d) -- cgit