backport stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 13 Apr 2011 11:46:00 +0200
changeset 7218 78622865b6c1
parent 7216 6053bf221fa9 (current diff)
parent 7217 4b860903d8c7 (diff)
child 7221 dc79f1a3c6ed
backport stable
--- a/devtools/__init__.py	Wed Apr 13 11:03:42 2011 +0200
+++ b/devtools/__init__.py	Wed Apr 13 11:46:00 2011 +0200
@@ -299,9 +299,12 @@
 
     def absolute_backup_file(self, db_id, suffix):
         """Path for config backup of a given database id"""
-        dbname = self.dbname.replace('-', '_')
+        # in case db name is an absolute path, we don't want to replace anything
+        # in parent directories
+        directory, basename = split(self.dbname)
+        dbname = basename.replace('-', '_')
         assert '.' not in db_id
-        filename = '%s-%s.%s' % (dbname, db_id, suffix)
+        filename = join(directory, '%s-%s.%s' % (dbname, db_id, suffix))
         return join(self._ensure_test_backup_db_dir(), filename)
 
     def db_cache_key(self, db_id, dbname=None):