diff options
author | SARL ENR 68 <david@david.david> | 2015-08-28 19:58:30 +0200 |
---|---|---|
committer | SARL ENR 68 <david@david.david> | 2015-08-28 19:58:30 +0200 |
commit | 73a2738eba0625fa9befcaeed690e035b12ab91e (patch) | |
tree | dc3d89fc33da63e2e4e354a74f8c219092f32f07 /src/msec/config.py | |
parent | 935d128177eac9d72b19c68bab8d7682a89c11d5 (diff) | |
download | msec-73a2738eba0625fa9befcaeed690e035b12ab91e.tar msec-73a2738eba0625fa9befcaeed690e035b12ab91e.tar.gz msec-73a2738eba0625fa9befcaeed690e035b12ab91e.tar.bz2 msec-73a2738eba0625fa9befcaeed690e035b12ab91e.tar.xz msec-73a2738eba0625fa9befcaeed690e035b12ab91e.zip |
Adaptation to python3 using 2to3-3.4 (mga#16524)
- by papoteur: https://bugs.mageia.org/attachment.cgi?id=6898
Diffstat (limited to 'src/msec/config.py')
-rwxr-xr-x | src/msec/config.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/msec/config.py b/src/msec/config.py index 9f41998..8caacfc 100755 --- a/src/msec/config.py +++ b/src/msec/config.py @@ -38,7 +38,7 @@ SECURITYLOG = '/var/log/msec.log' # localization try: - gettext.install('msec', unicode=1) + gettext.install('msec', str=1) except IOError: _ = str @@ -267,7 +267,7 @@ class MsecConfig: def list_options(self): """Sorts and returns configuration parameters""" - sortedparams = self.options.keys() + sortedparams = list(self.options.keys()) if sortedparams: sortedparams.sort() return sortedparams @@ -280,10 +280,10 @@ class MsecConfig: try: fd = open(self.config, "w") except: - self.log.error(_("Unable to save %s: %s") % (self.config, Narg(sys.exc_value))) + self.log.error(_("Unable to save %s: %s") % (self.config, Narg(sys.exc_info()[1]))) return False for comment in self.comments: - print >>fd, comment + print(comment, file=fd) # sorting keys for option in self.list_options(): value = self.options[option] @@ -310,7 +310,7 @@ class MsecConfig: pass else: value = '"%s"' % value - print >>fd, "%s=%s" % (option, value) + print("%s=%s" % (option, value), file=fd) return True # }}} @@ -373,7 +373,7 @@ class ExceptionConfig: def set(self, pos, value): """Sets a configuration option""" if pos > 0: - print "Pos: %d" % pos + print("Pos: %d" % pos) self.options[pos] = value else: self.options.append(value) @@ -393,17 +393,17 @@ class ExceptionConfig: try: fd = open(self.config, "w") except: - self.log.error(_("Unable to save %s: %s") % (self.config, Narg(sys.exc_value))) + self.log.error(_("Unable to save %s: %s") % (self.config, Narg(sys.exc_info()[1]))) return False for comment in self.comments: - print >>fd, comment + print(comment, file=fd) # sorting keys for option,value in self.options: # TODO: integrate with remove() if value == None or value == OPTION_DISABLED: self.log.debug("Skipping %s" % option) else: - print >>fd, "%s %s" % (option, value) + print("%s %s" % (option, value), file=fd) return True # }}} @@ -443,7 +443,7 @@ class PermConfig(MsecConfig): try: fd = open(self.config) except: - self.log.error(_("Unable to load configuration file %s: %s") % (self.config, Narg(sys.exc_value))) + self.log.error(_("Unable to load configuration file %s: %s") % (self.config, Narg(sys.exc_info()[1]))) return False for line in fd.readlines(): line = line.strip() @@ -488,10 +488,10 @@ class PermConfig(MsecConfig): try: fd = open(self.config, "w") except: - self.log.error(_("Unable to save %s: %s") % (self.config, Narg(sys.exc_value))) + self.log.error(_("Unable to save %s: %s") % (self.config, Narg(sys.exc_info()[1]))) return False for comment in self.comments: - print >>fd, comment + print(comment, file=fd) # sorting keys for file in self.options_order: value = self.options[file] @@ -509,6 +509,6 @@ class PermConfig(MsecConfig): force = "\tforce" else: force = "" - print >>fd, "%s\t%s.%s\t%s%s\t%s" % (file, user, group, perm, force, acl) + print("%s\t%s.%s\t%s%s\t%s" % (file, user, group, perm, force, acl), file=fd) return True # }}} |