def put(self, uri, data, content_type=''):
dbname, dburi = self._get_dburi(uri)
if not dbname or not dburi:
raise DAV_Forbidden
pool = Pool(Transaction().cursor.database_name)
Collection = pool.get('webdav.collection')
try:
res = Collection.put(dburi, data, content_type, cache=CACHE)
Transaction().cursor.commit()
except (DAV_Error, DAV_NotFound, DAV_Secret, DAV_Forbidden), exception:
self._log_exception(exception)
Transaction().cursor.rollback()
raise
except Exception, exception:
self._log_exception(exception)
Transaction().cursor.rollback()
raise DAV_Error(500)
if res:
uparts = list(urlparse.urlsplit(uri))
uparts[2] = res
res = urlparse.urlunsplit(uparts)
return res
评论列表
文章目录