From e3a704aa79cef58e2ebf0580185fee33e16e41bd Mon Sep 17 00:00:00 2001
From: Nicolas Delaby <nicolas@nexedi.com>
Date: Fri, 9 Jul 2010 13:24:11 +0000
Subject: [PATCH] remove is_indexable=0, created object is now wrapped in its
 final container.

May be using portal_contributions.newContent is better ??


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37020 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/WebDAVSupport.py | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/product/ERP5Type/WebDAVSupport.py b/product/ERP5Type/WebDAVSupport.py
index 2e8fff8c04..71a99de110 100644
--- a/product/ERP5Type/WebDAVSupport.py
+++ b/product/ERP5Type/WebDAVSupport.py
@@ -234,14 +234,10 @@ class Folder:
     if myType is not None and not myType.allowType( portal_type ) and \
        'portal_contributions' not in self.getPhysicalPath():
       raise ValueError('Disallowed subobject type: %s' % portal_type)
-    pt.constructContent( type_name=portal_type,
-                         container=self,
-                         id=name,
-                         is_indexable=0
-                         )
-
-    # constructContent does too much, so the object has to be removed again
-    obj = aq_base( self._getOb( name ) )
-    self._delObject( name ) # _delObject will not invoke the catalog since is_indexable was set to 0
-    delattr(obj, 'isIndexable') # Allow indexing again (standard case)
-    return obj
+    container = self.getPortalObject().getDefaultModule(portal_type)
+    pt.constructContent(type_name=portal_type,
+                        container=container,
+                        id=name)
+
+    document = container._getOb(name)
+    return document
-- 
2.30.9