summaryrefslogtreecommitdiff
path: root/addons/web/controllers/main.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-08-07 17:01:16 +0200
committerChristophe Simonis <chs@odoo.com>2018-08-07 17:01:16 +0200
commit65a80cf3fd2fd0c47c774ac9cc183d9d3bc4af55 (patch)
treedf78f525ff8140df45de948a02203d63c1108c54 /addons/web/controllers/main.py
parent43eca3079e488683983cd6ac2161c828b676f697 (diff)
parent0c5cbbe0bb4209dd6924494cd0c4d07dd3892b9e (diff)
[MERGE] forward port branch saas-14 up to 0c5cbbe0bb4
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 bbded29de1d..5d2d0c0bd2d 100644
--- a/addons/web/controllers/main.py
+++ b/addons/web/controllers/main.py
@@ -714,6 +714,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))
@@ -722,7 +724,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):