summaryrefslogtreecommitdiff
path: root/addons/web/controllers/main.py
diff options
context:
space:
mode:
authorSimon Lejeune <sle@openerp.com>2016-09-21 14:37:55 +0200
committerSimon Lejeune <sle@openerp.com>2016-09-21 15:56:59 +0200
commit5c6087e38ee671ad5a3cf5aaa501d2a46af49872 (patch)
treeeb97649426398f179390b94fb0587a879b960678 /addons/web/controllers/main.py
parentfbd4a2c73eb00f59611c90559e62194c17f82ecf (diff)
[FIX] web: dropping a database leads to an unusable cursor
Explicitly remove the cursor of the request. Dropping a database is not transactional and if overrides of ir_http's dispatch worked with the database (for example, utm), we are not able to commit the changes at the end of the request. It worked nice before rev 40561b0fb6b8f that changed the use of self.pool by request.env. Note: a cursor is always attached to an environment. Since the call to super possibly broke the cursor (for example by dropping the database), the end of the dispatch operation that try to commit and/or close the cursor could possibly result in the traceback 'unable to close a closed cursor' with request.env. With self.pool, it didn't happen because the code actually called in the utm's dispatch override doesn't use a cr and so there's nothing to close.
Diffstat (limited to 'addons/web/controllers/main.py')
-rw-r--r--addons/web/controllers/main.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py
index 08042763369..ce609a3b3e5 100644
--- a/addons/web/controllers/main.py
+++ b/addons/web/controllers/main.py
@@ -652,6 +652,7 @@ class Database(http.Controller):
def drop(self, master_pwd, name):
try:
dispatch_rpc('db','drop', [master_pwd, name])
+ request._cr = None # dropping a database leads to an unusable cursor
return http.local_redirect('/web/database/manager')
except Exception, e:
error = "Database deletion error: %s" % e