Doc Webdav: when scanning children, protect the cursor against exceptions.

bzr revid: p_christ@hol.gr-20101012103831-36qutrtz7avzb2ny
This commit is contained in:
P. Christeas 2010-10-12 13:38:31 +03:00
parent ef59ed0203
commit 2655d0e091
1 changed files with 19 additions and 18 deletions

View File

@ -288,26 +288,27 @@ class openerp_dav_handler(dav_interface):
result = []
node = self.uri2object(cr, uid, pool, uri2[:])
if not node:
if cr: cr.close()
raise DAV_NotFound2(uri2)
else:
fp = node.full_path()
if fp and len(fp):
self.parent.log_message('childs: @%s' % fp)
fp = '/'.join(fp)
try:
if not node:
raise DAV_NotFound2(uri2)
else:
fp = None
domain = None
if filters:
domain = node.get_domain(cr, filters)
for d in node.children(cr, domain):
self.parent.log_message('child: %s' % d.path)
if fp:
result.append( self.urijoin(dbname,fp,d.path) )
fp = node.full_path()
if fp and len(fp):
self.parent.log_message('childs: @%s' % fp)
fp = '/'.join(fp)
else:
result.append( self.urijoin(dbname,d.path) )
if cr: cr.close()
fp = None
domain = None
if filters:
domain = node.get_domain(cr, filters)
for d in node.children(cr, domain):
self.parent.log_message('child: %s' % d.path)
if fp:
result.append( self.urijoin(dbname,fp,d.path) )
else:
result.append( self.urijoin(dbname,d.path) )
finally:
if cr: cr.close()
return result
def uri2local(self, uri):