From 0f555fe021bc574f64cb2c0b306e847ecf5eca60 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bartek=20G=C3=B3rny?= <bartek@gorny.edu.pl>
Date: Tue, 21 Nov 2006 14:33:03 +0000
Subject: [PATCH] fixed webdav listing problem (thx Ivan); added PUT method
 which does ingestion

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11402 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5OOo/Document/DMSFile.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/product/ERP5OOo/Document/DMSFile.py b/product/ERP5OOo/Document/DMSFile.py
index d02267761a..d5a18c75b1 100644
--- a/product/ERP5OOo/Document/DMSFile.py
+++ b/product/ERP5OOo/Document/DMSFile.py
@@ -177,9 +177,11 @@ class DMSFile(XMLObject,File):
     '''
     try:
       return len(self.data)
-    except AttributeError:
+    except (AttributeError, TypeError):
       return 0
 
+  getcontentlength=get_size
+
   security.declareProtected(Permissions.View,'hasFile')
   def hasFile(self):
     """
@@ -274,9 +276,14 @@ class DMSFile(XMLObject,File):
     ref=self.getReference()
     return [o for o in di.keys() if o.getReference()!=ref] # every object has its own reference in SearchableText
 
+  security.declareProtected(Permissions.ModifyPortalContent,'PUT')
+  def PUT(self,REQUEST,RESPONSE):
+    CMFFile.PUT(self,REQUEST,RESPONSE)
+    self.DMS_ingestFile(fname=self.getId())
+
   # BG copied from File in case
   index_html = CMFFile.index_html
-  PUT = CMFFile.PUT
+  #PUT = CMFFile.PUT
   security.declareProtected('FTP access', 'manage_FTPget', 'manage_FTPstat', 'manage_FTPlist')
   manage_FTPget = CMFFile.manage_FTPget
   manage_FTPlist = CMFFile.manage_FTPlist
-- 
2.30.9