Fix python2 bug when creating backup filename
This commit is contained in:
parent
061a289bde
commit
20c9d949ac
@ -552,12 +552,14 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
|||||||
|
|
||||||
def __make_zip_backup(self, dirname):
|
def __make_zip_backup(self, dirname):
|
||||||
import zipfile
|
import zipfile
|
||||||
if sys.version_info[0] < 3:
|
|
||||||
from string import maketrans
|
|
||||||
title = self.get_dbname()
|
|
||||||
# In Windows resrved characters is "<>:"/\|?*"
|
# In Windows resrved characters is "<>:"/\|?*"
|
||||||
reserved_char = r':,<>"/\|?* '
|
reserved_char = r':,<>"/\|?* '
|
||||||
replace_char = "-__________"
|
replace_char = "-__________"
|
||||||
|
title = self.get_dbname()
|
||||||
|
if sys.version_info[0] < 3:
|
||||||
|
from string import maketrans
|
||||||
|
trans = maketrans(reserved_char, replace_char)
|
||||||
|
else:
|
||||||
trans = title.maketrans(reserved_char, replace_char)
|
trans = title.maketrans(reserved_char, replace_char)
|
||||||
title = title.translate(trans)
|
title = title.translate(trans)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user