portal_workflow中的“更新安全设置”会不必要地触发目录元数据更新?

时间:2011-04-04 16:18:38

标签: plone zope

Plone 3.3.5:我们有一个中等规模的Plone网站,我们想更新其工作流程。由于这是一个长期运行的过程,我们发现了一些奇怪的事情。我们的Archetypes访问器,与安全无关,在portal_workflow中点击“更新安全设置”时调用。

看起来罪魁祸首是ZCatalog中的update_metadata = 1默认设置:

-> self.plone_log("treatmentToImagingHours: %s"%str(treatmentToImagingHours))
(Pdb) bt
  /Users/moo/sits/parts/zope2/lib/python/ZServer/PubCore/ZServerPublisher.py(25)__init__()
-> response=b)
  /Users/moo/sits/parts/zope2/lib/python/ZPublisher/Publish.py(401)publish_module()
-> environ, debug, request, response)
  /Users/moo/sits/parts/zope2/lib/python/ZPublisher/Publish.py(202)publish_module_standard()
-> response = publish(request, module_name, after_list, debug=debug)
  /Users/moo/sits/parts/zope2/lib/python/ZPublisher/Publish.py(119)publish()
-> request, bind=1)
  /Users/moo/sits/parts/zope2/lib/python/ZPublisher/mapply.py(88)mapply()
-> if debug is not None: return debug(object,args,context)
  /Users/moo/sits/parts/zope2/lib/python/ZPublisher/Publish.py(42)call_object()
-> result=apply(object,args) # Type s<cr> to step into published object.
  <string>(4)_facade()
  /Users/moo/sits/parts/zope2/lib/python/AccessControl/requestmethod.py(64)_curried()
-> return callable(*args, **kw)
  /Users/moo/sits/eggs/Products.CMFCore-2.1.2-py2.4.egg/Products/CMFCore/WorkflowTool.py(457)updateRoleMappings()
-> count = self._recursiveUpdateRoleMappings(portal, wfs)
  /Users/moo/sits/eggs/Products.CMFCore-2.1.2-py2.4.egg/Products/CMFCore/WorkflowTool.py(609)_recursiveUpdateRoleMappings()
-> count = count + self._recursiveUpdateRoleMappings(v, wfs)
  /Users/moo/sits/eggs/Products.CMFCore-2.1.2-py2.4.egg/Products/CMFCore/WorkflowTool.py(609)_recursiveUpdateRoleMappings()
-> count = count + self._recursiveUpdateRoleMappings(v, wfs)
  /Users/moo/sits/eggs/Products.CMFCore-2.1.2-py2.4.egg/Products/CMFCore/WorkflowTool.py(609)_recursiveUpdateRoleMappings()
-> count = count + self._recursiveUpdateRoleMappings(v, wfs)
  /Users/moo/sits/eggs/Products.CMFCore-2.1.2-py2.4.egg/Products/CMFCore/WorkflowTool.py(609)_recursiveUpdateRoleMappings()
-> count = count + self._recursiveUpdateRoleMappings(v, wfs)
  /Users/moo/sits/eggs/Products.CMFCore-2.1.2-py2.4.egg/Products/CMFCore/WorkflowTool.py(609)_recursiveUpdateRoleMappings()
-> count = count + self._recursiveUpdateRoleMappings(v, wfs)
  /Users/moo/sits/eggs/Products.CMFCore-2.1.2-py2.4.egg/Products/CMFCore/WorkflowTool.py(600)_recursiveUpdateRoleMappings()
-> ob.reindexObject(idxs=['allowedRolesAndUsers'])
  /Users/moo/sits/eggs/Products.Archetypes-1.5.11-py2.4.egg/Products/Archetypes/CatalogMultiplex.py(115)reindexObject()
-> c.catalog_object(self, url, idxs=lst)
  /Users/moo/sits/eggs/Plone-3.3rc2-py2.4.egg/Products/CMFPlone/CatalogTool.py(417)catalog_object()
-> update_metadata, pghandler=pghandler)
  /Users/moo/sits/parts/zope2/lib/python/Products/ZCatalog/ZCatalog.py(536)catalog_object()
-> update_metadata=update_metadata)
  /Users/moo/sits/parts/zope2/lib/python/Products/ZCatalog/Catalog.py(348)catalogObject()
-> self.updateMetadata(object, uid)
  /Users/moo/sits/parts/zope2/lib/python/Products/ZCatalog/Catalog.py(277)updateMetadata()
-> newDataRecord = self.recordify(object)
  /Users/moo/sits/parts/zope2/lib/python/Products/ZCatalog/Catalog.py(417)recordify()
-> if(attr is not MV and safe_callable(attr)): attr=attr()
  /Users/moo/sits/products/SitsPatient/content/SitsPatient.py(2452)outSichECASS()

portal_workflow调用ob.reindexObject(idxs = ['allowedRolesAndUsers'])。但是,这会触发刷新所有元数据。

1)这是正常行为吗?

2)这是期望的行为吗?

3)我可以关闭update_metadata以加快进程而不会破坏任何内容吗?门户网站安全性是否依赖于元数据?

1 个答案:

答案 0 :(得分:4)

是的,这是正常行为。目录存储对象提供的信息子集作为缓存,因此您可以只使用目录结果呈现页面而无需唤醒原始对象。这包括对象的当前工作流状态。

重建索引时,目录也必须更新元数据,因为它无法确定数据是否已更改。

在此特定过程中,如果不进行修补,则无法关闭update_metadata;你必须要么:

  • patch Products.ZCatalog.Catalog.catalogObject在那里关闭update_metadata,

  • patch Products.Archetypes.CatalogMultiplex.CatalogMultiplex.reindexObject调用catalogObject,并将update_metadata标志设置为False,

  • 修补工作流工具以调用reindexObjectSecurity而不是reindexObject。

您必须审核目录架构(元数据)列,以查看更新工作流安全性时是否确实没有任何更改。