summaryrefslogtreecommitdiff
path: root/addons/web/controllers/main.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-08-09 19:33:32 +0200
committerChristophe Simonis <chs@odoo.com>2018-08-09 19:33:32 +0200
commit7717f082c08d6121cd7d2478e14ff855afd6d384 (patch)
tree5b26650048ba249f021792c1d4cb5900e7f0f7a4 /addons/web/controllers/main.py
parentd3df57bf906b3ff1964d3c96ea6b45950858099c (diff)
parentaf35aea6b0d6ff52126141ab0e3754a0427553fc (diff)
[MERGE] forward port branch saas-11.3 up to af35aea6b0d
Diffstat (limited to 'addons/web/controllers/main.py')
-rw-r--r--addons/web/controllers/main.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py
index cd0f2ff0873..930dde340ed 100644
--- a/addons/web/controllers/main.py
+++ b/addons/web/controllers/main.py
@@ -744,6 +744,8 @@ class Database(http.Controller):
@http.route('/web/database/restore', type='http', auth="none", methods=['POST'], csrf=False)
def restore(self, master_pwd, backup_file, name, copy=False):
try:
+ data_file = None
+ db.check_super(master_pwd)
with tempfile.NamedTemporaryFile(delete=False) as data_file:
backup_file.save(data_file)
db.restore_db(name, data_file.name, str2bool(copy))
@@ -752,7 +754,8 @@ class Database(http.Controller):
error = "Database restore error: %s" % (str(e) or repr(e))
return self._render_template(error=error)
finally:
- os.unlink(data_file.name)
+ if data_file:
+ os.unlink(data_file.name)
@http.route('/web/database/change_password', type='http', auth="none", methods=['POST'], csrf=False)
def change_password(self, master_pwd, master_pwd_new):