Doc Webdav: close cursor when dav_get_eprop raises Exceptions.
authorP. Christeas <p_christ@hol.gr>
Thu, 14 Oct 2010 11:41:59 +0000 (14:41 +0300)
committerP. Christeas <p_christ@hol.gr>
Thu, 14 Oct 2010 11:41:59 +0000 (14:41 +0300)
bzr revid: p_christ@hol.gr-20101014114159-ek4fp05fvjygobr2

addons/document_webdav/dav_fs.py

index f615647..4665610 100644 (file)
@@ -215,12 +215,13 @@ class openerp_dav_handler(dav_interface):
         if not dbname:
             if cr: cr.close()
             raise DAV_NotFound
-        node = self.uri2object(cr, uid, pool, uri2)
-        if not node:
+        try:
+            node = self.uri2object(cr, uid, pool, uri2)
+            if not node:
+                raise DAV_NotFound
+            res = node.get_dav_eprop(cr, ns, propname)
+        finally:
             cr.close()
-            raise DAV_NotFound
-        res = node.get_dav_eprop(cr, ns, propname)
-        cr.close()
         return res
 
     def get_db(self, uri, rest_ret=False, allow_last=False):