Raise only DAV_ exception to webdav server
This commit is contained in:
+74
-22
@@ -174,12 +174,17 @@ class TrytonDAVInterface(iface.dav_interface):
|
||||
if not dbname in database_list:
|
||||
pool.init()
|
||||
try:
|
||||
collection_obj = pool.get('webdav.collection')
|
||||
if uri[-1:] != '/':
|
||||
uri += '/'
|
||||
for child in collection_obj.get_childs(cursor, int(USER_ID), dburi,
|
||||
cache=CACHE):
|
||||
res.append(urlparse.urljoin(self.baseuri, uri + child))
|
||||
try:
|
||||
collection_obj = pool.get('webdav.collection')
|
||||
if uri[-1:] != '/':
|
||||
uri += '/'
|
||||
for child in collection_obj.get_childs(cursor, int(USER_ID), dburi,
|
||||
cache=CACHE):
|
||||
res.append(urlparse.urljoin(self.baseuri, uri + child))
|
||||
except (DAV_Error, DAV_NotFound, DAV_Secret, DAV_Forbidden):
|
||||
raise
|
||||
except:
|
||||
raise DAV_Error(500)
|
||||
finally:
|
||||
cursor.close()
|
||||
return res
|
||||
@@ -220,8 +225,13 @@ class TrytonDAVInterface(iface.dav_interface):
|
||||
pool.init()
|
||||
collection_obj = pool.get('webdav.collection')
|
||||
try:
|
||||
res = collection_obj.get_data(cursor, int(USER_ID), dburi,
|
||||
cache=CACHE)
|
||||
try:
|
||||
res = collection_obj.get_data(cursor, int(USER_ID), dburi,
|
||||
cache=CACHE)
|
||||
except (DAV_Error, DAV_NotFound, DAV_Secret, DAV_Forbidden):
|
||||
raise
|
||||
except:
|
||||
raise DAV_Error(500)
|
||||
finally:
|
||||
cursor.close()
|
||||
return res
|
||||
@@ -242,9 +252,12 @@ class TrytonDAVInterface(iface.dav_interface):
|
||||
res = collection_obj.put(cursor, int(USER_ID), dburi, data,
|
||||
content_type, cache=CACHE)
|
||||
cursor.commit()
|
||||
except:
|
||||
except (DAV_Error, DAV_NotFound, DAV_Secret, DAV_Forbidden):
|
||||
cursor.rollback()
|
||||
raise
|
||||
except:
|
||||
cursor.rollback()
|
||||
raise DAV_Error(500)
|
||||
finally:
|
||||
cursor.close()
|
||||
return res
|
||||
@@ -265,9 +278,12 @@ class TrytonDAVInterface(iface.dav_interface):
|
||||
res = collection_obj.mkcol(cursor, int(USER_ID), dburi,
|
||||
cache=CACHE)
|
||||
cursor.commit()
|
||||
except:
|
||||
except (DAV_Error, DAV_NotFound, DAV_Secret, DAV_Forbidden):
|
||||
cursor.rollback()
|
||||
raise
|
||||
except:
|
||||
cursor.rollback()
|
||||
raise DAV_Error(500)
|
||||
finally:
|
||||
cursor.close()
|
||||
return res
|
||||
@@ -284,8 +300,13 @@ class TrytonDAVInterface(iface.dav_interface):
|
||||
pool.init()
|
||||
collection_obj = pool.get('webdav.collection')
|
||||
try:
|
||||
res = collection_obj.get_resourcetype(cursor, int(USER_ID), dburi,
|
||||
try:
|
||||
res = collection_obj.get_resourcetype(cursor, int(USER_ID), dburi,
|
||||
cache=CACHE)
|
||||
except (DAV_Error, DAV_NotFound, DAV_Secret, DAV_Forbidden):
|
||||
raise
|
||||
except:
|
||||
raise DAV_Error(500)
|
||||
finally:
|
||||
cursor.close()
|
||||
return res
|
||||
@@ -305,8 +326,13 @@ class TrytonDAVInterface(iface.dav_interface):
|
||||
pool.init()
|
||||
collection_obj = pool.get('webdav.collection')
|
||||
try:
|
||||
res = collection_obj.get_contentlength(cursor, int(USER_ID), dburi,
|
||||
cache=CACHE)
|
||||
try:
|
||||
res = collection_obj.get_contentlength(cursor, int(USER_ID), dburi,
|
||||
cache=CACHE)
|
||||
except (DAV_Error, DAV_NotFound, DAV_Secret, DAV_Forbidden):
|
||||
raise
|
||||
except:
|
||||
raise DAV_Error(500)
|
||||
finally:
|
||||
cursor.close()
|
||||
return res
|
||||
@@ -323,8 +349,13 @@ class TrytonDAVInterface(iface.dav_interface):
|
||||
pool.init()
|
||||
collection_obj = pool.get('webdav.collection')
|
||||
try:
|
||||
res = collection_obj.get_contenttype(cursor, int(USER_ID), dburi,
|
||||
cache=CACHE)
|
||||
try:
|
||||
res = collection_obj.get_contenttype(cursor, int(USER_ID), dburi,
|
||||
cache=CACHE)
|
||||
except (DAV_Error, DAV_NotFound, DAV_Secret, DAV_Forbidden):
|
||||
raise
|
||||
except:
|
||||
raise DAV_Error(500)
|
||||
finally:
|
||||
cursor.close()
|
||||
return res
|
||||
@@ -344,8 +375,13 @@ class TrytonDAVInterface(iface.dav_interface):
|
||||
pool.init()
|
||||
collection_obj = pool.get('webdav.collection')
|
||||
try:
|
||||
res = collection_obj.get_creationdate(cursor, int(USER_ID), dburi,
|
||||
cache=CACHE)
|
||||
try:
|
||||
res = collection_obj.get_creationdate(cursor, int(USER_ID), dburi,
|
||||
cache=CACHE)
|
||||
except (DAV_Error, DAV_NotFound, DAV_Secret, DAV_Forbidden):
|
||||
raise
|
||||
except:
|
||||
raise DAV_Error(500)
|
||||
finally:
|
||||
cursor.close()
|
||||
return res
|
||||
@@ -362,8 +398,13 @@ class TrytonDAVInterface(iface.dav_interface):
|
||||
pool.init()
|
||||
collection_obj = pool.get('webdav.collection')
|
||||
try:
|
||||
res = collection_obj.get_lastmodified(cursor, int(USER_ID), dburi,
|
||||
cache=CACHE)
|
||||
try:
|
||||
res = collection_obj.get_lastmodified(cursor, int(USER_ID), dburi,
|
||||
cache=CACHE)
|
||||
except (DAV_Error, DAV_NotFound, DAV_Secret, DAV_Forbidden):
|
||||
raise
|
||||
except:
|
||||
raise DAV_Error(500)
|
||||
finally:
|
||||
cursor.close()
|
||||
return res
|
||||
@@ -384,9 +425,12 @@ class TrytonDAVInterface(iface.dav_interface):
|
||||
res = collection_obj.rmcol(cursor, int(USER_ID), dburi,
|
||||
cache=CACHE)
|
||||
cursor.commit()
|
||||
except:
|
||||
except (DAV_Error, DAV_NotFound, DAV_Secret, DAV_Forbidden):
|
||||
cursor.rollback()
|
||||
raise
|
||||
except:
|
||||
cursor.rollback()
|
||||
raise DAV_Error(500)
|
||||
finally:
|
||||
cursor.close()
|
||||
return res
|
||||
@@ -407,9 +451,12 @@ class TrytonDAVInterface(iface.dav_interface):
|
||||
res = collection_obj.rm(cursor, int(USER_ID), dburi,
|
||||
cache=CACHE)
|
||||
cursor.commit()
|
||||
except:
|
||||
except (DAV_Error, DAV_NotFound, DAV_Secret, DAV_Forbidden):
|
||||
cursor.rollback()
|
||||
raise
|
||||
except:
|
||||
cursor.rollback()
|
||||
raise DAV_Error(500)
|
||||
finally:
|
||||
cursor.close()
|
||||
return res
|
||||
@@ -426,7 +473,12 @@ class TrytonDAVInterface(iface.dav_interface):
|
||||
pool.init()
|
||||
collection_obj = pool.get('webdav.collection')
|
||||
try:
|
||||
res = collection_obj.exists(cursor, int(USER_ID), dburi, cache=CACHE)
|
||||
try:
|
||||
res = collection_obj.exists(cursor, int(USER_ID), dburi, cache=CACHE)
|
||||
except (DAV_Error, DAV_NotFound, DAV_Secret, DAV_Forbidden):
|
||||
raise
|
||||
except:
|
||||
raise DAV_Error(500)
|
||||
finally:
|
||||
cursor.close()
|
||||
return res
|
||||
|
||||
Reference in New Issue
Block a user