[FIX] close the cursor when an exception occur

bzr revid: christophe@cobalt-20081219191657-03rnpi2t51j3iy5x
This commit is contained in:
Christophe Simonis
2008-12-19 20:16:57 +01:00
parent 977b67fe1e
commit 39e7d6f8cc
+2 -2
View File
@@ -462,11 +462,10 @@ class report_spool(netsvc.Service):
self._reports[id] = {'uid': uid, 'result': False, 'state': False, 'exception': None}
def go(id, uid, ids, datas, context):
cr = pooler.get_db(db).cursor()
try:
cr = pooler.get_db(db).cursor()
obj = netsvc.LocalService('report.'+object)
(result, format) = obj.create(cr, uid, ids, datas, context)
cr.close()
self._reports[id]['result'] = result
self._reports[id]['format'] = format
self._reports[id]['state'] = True
@@ -480,6 +479,7 @@ class report_spool(netsvc.Service):
'Exception: %s\n%s' % (str(exception), tb_s))
self._reports[id]['exception'] = exception
self._reports[id]['state'] = True
cr.close()
return True
thread.start_new_thread(go, (id, uid, ids, datas, context))