summaryrefslogtreecommitdiff
path: root/addons/web/controllers/main.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-08-07 16:54:18 +0200
committerChristophe Simonis <chs@odoo.com>2018-08-07 16:54:18 +0200
commit0c5cbbe0bb4209dd6924494cd0c4d07dd3892b9e (patch)
tree62472770e4559486ed8ead37d29af0642f8a482c /addons/web/controllers/main.py
parent1f92477cf46af9580d6cb4b2a430254875e83ed1 (diff)
parent692a32e78098d57507c6ca2a5ac956af0f652446 (diff)
[MERGE] forward port branch 10.0 up to 692a32e7809
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 ff6dac34c05..3a4ca384657 100644
--- a/addons/web/controllers/main.py
+++ b/addons/web/controllers/main.py
@@ -711,6 +711,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))
@@ -719,7 +721,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):