Ver código fonte

Do not convert if the destination file already exists...

oz123 11 anos atrás
pai
commit
5d434d822a
1 arquivos alterados com 3 adições e 0 exclusões
  1. 3 0
      pwman/data/convertdb.py

+ 3 - 0
pwman/data/convertdb.py

@@ -68,6 +68,9 @@ class PwmanConvertDB(object):
         self.oldnodes = self.db.getnodes(self.oldnodes)
 
     def create_new_db(self):
+        dest = '-newdb'.join(os.path.splitext(self.dbname))
+        if os.path.exists('-newdb'.join(os.path.splitext(self.dbname))):
+            raise Exception("%s already exists, please move this file!" % dest)
         self.newdb_name = '-newdb'.join(os.path.splitext(self.dbname))
 
         self.newdb = pwman.data.factory.create(self.dbtype, _NEWVERSION,