Commit b98bbbbf authored by Jean-Paul Smets's avatar Jean-Paul Smets

New WebDAV PUT method handles much better catalog and uid related issues in...

New WebDAV PUT method handles much better catalog and uid related issues in ContributionTool. The main difference with the standard one is that we call here constructContent with is_indexable=0. This way, documents which are created are not indexed.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15685 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 22c17c7c
......@@ -41,6 +41,7 @@ from Products.ERP5Type import PropertySheet, Permissions
from Products.ERP5Type.XMLExportImport import Folder_asXML
from Products.ERP5Type.Cache import CachingMethod
from Products.ERP5Type.Utils import sortValueList
from Products.ERP5Type.WebDAVSupport import Folder as WebDAVFolder
try:
from Products.CMFCore.CMFBTreeFolder import CMFBTreeFolder
......@@ -294,7 +295,7 @@ class FolderMixIn(ExtensionClass.Base):
"""
return self.countFolder(**kw)[0][0]
class Folder( CopyContainer, CMFBTreeFolder, Base, FolderMixIn):
class Folder( CopyContainer, CMFBTreeFolder, Base, FolderMixIn, WebDAVFolder):
"""
A Folder is a subclass of Base but not of XMLObject.
Folders are not considered as documents and are therefore
......@@ -353,6 +354,7 @@ class Folder( CopyContainer, CMFBTreeFolder, Base, FolderMixIn):
_edit = Base._edit
_setPropValue = Base._setPropValue
_propertyMap = Base._propertyMap # are there any others XXX ?
PUT_factory = WebDAVFolder.PUT_factory
# XXX Prevent inheritance from PortalFolderBase
description = None
......
......@@ -13,9 +13,11 @@
##############################################################################
import re
from Acquisition import aq_parent, aq_inner, aq_base
from AccessControl import ClassSecurityInfo, ModuleSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.CMFCore.PortalContent import NoWL, ResourceLockedError
from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.utils import parseHeadersBody
from Products.CMFDefault.utils import html_headcheck
from Products.CMFDefault.utils import bodyfinder
......@@ -189,4 +191,43 @@ class TextContent:
security.declareProtected(Permissions.View, 'get_size')
def get_size( self ):
""" Used for FTP and apparently the ZMI now too """
return len(self.manage_FTPget())
\ No newline at end of file
return len(self.manage_FTPget())
class Folder:
"""
Taken from CMFCore.PortalFolder
"""
def PUT_factory( self, name, typ, body ):
""" Factory for PUT requests to objects which do not yet exist.
Used by NullResource.PUT.
Returns -- Bare and empty object of the appropriate type (or None, if
we don't know what to do)
"""
registry = getToolByName(self, 'content_type_registry', None)
if registry is None:
return None
portal_type = registry.findTypeName( name, typ, body )
if portal_type is None:
return None
# The code bellow is inspired from ERP5Type.Core.Folder.newContent
pt = self._getTypesTool()
myType = pt.getTypeInfo(self)
if myType is not None and not myType.allowType( portal_type ) and \
'portal_trash' 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
) # **kw) removed due to CMF bug
# 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment