Convert cache_name by TableHandler when used as database name

The name of the cache can be longer than the maximum length of database name.
This commit is contained in:
Cédric Krier committed 2019-07-28 16:05:45 +02:00
1 parent e703f3f048
commit ac9fc496df
1 file changed
+2
+2
View File
@@ -163,6 +163,7 @@ def _pg_restore(cache_file):
return not subprocess.call(cmd, env=env)
except OSError:
cache_name, _ = os.path.splitext(os.path.basename(cache_file))
cache_name = backend.get('TableHandler').convert_name(cache_name)
with Transaction().start(
None, 0, close=True, autocommit=True) as transaction:
transaction.database.drop(transaction.connection, DB_NAME)
@@ -180,6 +181,7 @@ def _pg_dump(cache_file):
return not subprocess.call(cmd, env=env)
except OSError:
cache_name, _ = os.path.splitext(os.path.basename(cache_file))
cache_name = backend.get('TableHandler').convert_name(cache_name)
# Ensure any connection is left open
backend.get('Database')(DB_NAME).close()
with Transaction().start(