diff --git a/product/ERP5Type/ZopePatch.py b/product/ERP5Type/ZopePatch.py index a5cfbc625729f0683d01b2ebe514d10fe24d38d8..2bf3bcd276f90c86bffc5319c1431d487e03db68 100755 --- a/product/ERP5Type/ZopePatch.py +++ b/product/ERP5Type/ZopePatch.py @@ -27,6 +27,38 @@ from zLOG import LOG from string import join +############################################################################## +# Folder naming: member folder should be names as a singular in small caps +from Products.CMFDefault.MembershipTool import MembershipTool +MembershipTool.membersfolder_id = 'member' + +############################################################################## +# Import: add rename feature +from OFS.ObjectManager import ObjectManager, customImporters +class PatchedObjectManager(ObjectManager): + def _importObjectFromFile(self, filepath, verify=1, set_owner=1, id=None): + # locate a valid connection + connection=self._p_jar + obj=self + + while connection is None: + obj=obj.aq_parent + connection=obj._p_jar + ob=connection.importFile( + filepath, customImporters=customImporters) + if verify: self._verifyObjectPaste(ob, validate_src=0) + if id is None: + id=ob.id + if hasattr(id, 'im_func'): id=id() + self._setObject(id, ob, set_owner=set_owner) + + # try to make ownership implicit if possible in the context + # that the object was imported into. + ob=self._getOb(id) + ob.manage_changeOwnershipType(explicit=0) + +ObjectManager._importObjectFromFile=PatchedObjectManager._importObjectFromFile + ############################################################################## # Properties from OFS.PropertyManager import PropertyManager, type_converters