diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-08-09 15:06:31 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-08-09 15:06:31 +0200 |
| commit | 9cb97a8c2daec720a2ccb8220f07b04a8786876c (patch) | |
| tree | 8875292477a40d9f5d134d743c811231960ce525 /addons/web/controllers | |
| parent | 33e7479865763e8c8255db7e057ef4703bef6093 (diff) | |
| parent | 499af66727e46272efcd7f6785176097642cb096 (diff) | |
[MERGE] forward port branch saas-11.2 up to 499af66727e
Diffstat (limited to 'addons/web/controllers')
| -rw-r--r-- | addons/web/controllers/main.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 41d5d229772..c4fba082be2 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): |
