summaryrefslogtreecommitdiffstats
path: root/ipapython
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2016-02-19 17:38:30 +0100
committerJan Cholasta <jcholast@redhat.com>2016-03-03 10:31:55 +0100
commit272ff9d1f71e1b49645b7ceb0e6db975f4625ff0 (patch)
treee5438bf0eaec01589c46b4cc4921f903c601328f /ipapython
parentcec7df5c54122c4ca2d7cee681f2e16b81fd6040 (diff)
downloadfreeipa-272ff9d1f71e1b49645b7ceb0e6db975f4625ff0.tar.gz
freeipa-272ff9d1f71e1b49645b7ceb0e6db975f4625ff0.tar.xz
freeipa-272ff9d1f71e1b49645b7ceb0e6db975f4625ff0.zip
ipapython.sysrestore: Use str methods instead of functions from the string module
For historical reasons, the string module contained some functions that mirror methods of the str type. These are eremoved in Python 3. Use str methods instead. Part of the work for https://fedorahosted.org/freeipa/ticket/5638 Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipapython')
-rw-r--r--ipapython/sysrestore.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/ipapython/sysrestore.py b/ipapython/sysrestore.py
index c43948db5..c1c2bce87 100644
--- a/ipapython/sysrestore.py
+++ b/ipapython/sysrestore.py
@@ -28,7 +28,6 @@ import os.path
import shutil
from ipapython.ipa_log_manager import root_logger
import random
-import string
import six
from six.moves.configparser import SafeConfigParser
@@ -133,7 +132,8 @@ class FileStore:
stat = os.stat(path)
- self.files[filename] = string.join([str(stat.st_mode),str(stat.st_uid),str(stat.st_gid),path], ',')
+ template = '{stat.st_mode},{stat.st_uid},{stat.st_gid},{path}'
+ self.files[filename] = template.format(stat=stat, path=path)
self.save()
def has_file(self, path):
@@ -143,7 +143,7 @@ class FileStore:
"""
result = False
for (key, value) in self.files.items():
- (mode,uid,gid,filepath) = string.split(value, ',', 3)
+ (mode,uid,gid,filepath) = value.split(',', 3)
if (filepath == path):
result = True
break
@@ -176,7 +176,7 @@ class FileStore:
filename = None
for (key, value) in self.files.items():
- (mode,uid,gid,filepath) = string.split(value, ',', 3)
+ (mode,uid,gid,filepath) = value.split(',', 3)
if (filepath == path):
filename = key
break
@@ -218,7 +218,7 @@ class FileStore:
for (filename, value) in self.files.items():
- (mode,uid,gid,path) = string.split(value, ',', 3)
+ (mode,uid,gid,path) = value.split(',', 3)
backup_path = os.path.join(self._path, filename)
if not os.path.exists(backup_path):
@@ -267,7 +267,7 @@ class FileStore:
filename = None
for (key, value) in self.files.items():
- (mode,uid,gid,filepath) = string.split(value, ',', 3)
+ (mode,uid,gid,filepath) = value.split(',', 3)
if (filepath == path):
filename = key
break