X-Git-Url: https://scm.cri.mines-paristech.fr/git/MosaicDocument.git/blobdiff_plain/1aed5a5073041e18e085d5f03b320efa7e9a0f71..155c6ba3d7e8e9693d30b3cf70f591f0153610b6:/MosaicBlockInformation.py diff --git a/MosaicBlockInformation.py b/MosaicBlockInformation.py index f284df7..444c791 100755 --- a/MosaicBlockInformation.py +++ b/MosaicBlockInformation.py @@ -25,6 +25,7 @@ from Globals import InitializeClass, DTMLFile from Products.CMFCore.TypesTool import FactoryTypeInformation from Products.CMFCore.utils import getToolByName from types import InstanceType +import config from AccessControl import ClassSecurityInfo, Unauthorized from Products.CMFCore.permissions import View, ModifyPortalContent, \ @@ -42,9 +43,8 @@ addMosaicBlockInformationForm = DTMLFile('dtml/addMosaicBlockForm', globals()) def addMosaicBlockInformation(self, id=None, blockType = '', metaFti = None, REQUEST=None) : """Add a MosaicBlock""" - mosaicTool = self.mosaic_tool if blockType : - metaFtis = mosaicTool.getDefaultBlockMetaFtis() + metaFtis = config.getDefaultBlockMetaFtis() if not metaFtis.has_key(blockType) : raise ValueError, "Unknown block type : %s" % blockType else : @@ -233,14 +233,11 @@ class MosaicBlockInformation(ObjectManager, FactoryTypeInformation) : return FactoryTypeInformation._getFactoryMethod(self, container) raise Unauthorized, ('Cannot create %s' % self.getId()) - - - security.declarePrivate('_finishConstruction') - def _finishConstruction(self, ob) : - """Finish the construction of a content block object.""" - if hasattr(ob, '_setPortalTypeName'): - ob._setPortalTypeName(self.getId()) - + + + security.declarePrivate('_constructInstance') + def _constructInstance(self, container, id, *args, **kw): + ob = super(MosaicBlockInformation, self)._constructInstance(container, id, *args, **kw) typesTool = getToolByName(self, 'portal_types') # Add and init slots in block @@ -250,9 +247,6 @@ class MosaicBlockInformation(ObjectManager, FactoryTypeInformation) : kw[key] = value typesTool.constructContent(si.type, ob, si.id, **kw) - - if self.notify_wf : - ob.notifyWorkflowCreated() return ob