Handle displayname on webdav.collection

This commit is contained in:
Cédric Krier committed 2009-11-10 16:04:05 +01:00
1 parent bc69da34f7
commit e67d02a97f
3 files changed
+26 -1

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
* Handle displayname on webdav.collection
* Handle current-user-privilege-set on webdav.collection
Version 1.4.0 - 2009-10-19
+18 -1
View File
@@ -316,7 +316,24 @@ class TrytonDAVInterface(iface.dav_interface):
return res
def _get_dav_displayname(self, uri):
return uri.split('/')[-1]
dbname, dburi = self._get_dburi(uri)
if not dbname or not dburi:
return uri.split('/')[-1]
cursor = DATABASE['cursor']
pool = Pool(DATABASE['dbname'])
try:
collection_obj = pool.get('webdav.collection')
res = collection_obj.get_displayname(cursor, int(USER_ID), dburi,
cache=CACHE)
except KeyError:
raise DAV_NotFound
except (DAV_Error, DAV_NotFound, DAV_Secret, DAV_Forbidden), exception:
self._log_exception(exception)
raise
except Exception, exception:
self._log_exception(exception)
raise DAV_Error(500)
return res
def _get_dav_getcontentlength(self, uri):
dbname, dburi = self._get_dburi(uri)
+7
View File
@@ -329,6 +329,13 @@ class Collection(ModelSQL, ModelView):
return OBJECT
return COLLECTION
def get_displayname(self, cursor, user, uri, context=None, cache=None):
object_name, object_id = self._uri2object(cursor, user, uri,
context=context, cache=cache)
model_obj = self.pool.get(object_name)
return model_obj.browse(cursor, user, object_id, context=context)\
.rec_name
def get_contentlength(self, cursor, user, uri, context=None, cache=None):
attachment_obj = self.pool.get('ir.attachment')