[Erp5-report] r29876 - /erp5/trunk/products/ERP5Type/Base.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Oct 21 16:08:01 CEST 2009


Author: leonardo
Date: Wed Oct 21 16:07:55 2009
New Revision: 29876

URL: http://svn.erp5.org?rev=29876&view=rev
Log:
Avoid inheriting index_html from the ERP5 site, restoring behaviour lost on CMF 2, plus block reindexing by events by removing our IContentish interface when on CMF 2, since our objects reindex themselves on manage_afterAdd (approved by jm)

Modified:
    erp5/trunk/products/ERP5Type/Base.py

Modified: erp5/trunk/products/ERP5Type/Base.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Base.py?rev=29876&r1=29875&r2=29876&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Base.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Base.py [utf8] Wed Oct 21 16:07:55 2009
@@ -79,6 +79,8 @@
 from Products.ERP5Type.Accessor.TypeDefinition import asDate
 from Products.ERP5Type.Message import Message
 from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
+
+from zope.interface import classImplementsOnly, implementedBy
 
 from string import join
 import sys, re
@@ -2620,6 +2622,15 @@
   security.declareProtected(Permissions.View, '__call__')
   __call__ = view
 
+  # This special value informs ZPublisher to use __call__. We define it here
+  # since Products.CMFCore.PortalContent.PortalContent stopped defining it on
+  # CMF 2.x. They use aliases and Zope3 style views now and make pretty sure
+  # not to let zpublisher reach this value.
+  index_html = None
+  # By the Way, Products.ERP5.Document.File and .Image define their own
+  # index_html to make sure this value here is not used so that they're
+  # downloadable by their naked URL.
+
   security.declareProtected(Permissions.View, 'list')
   def list(self, reset=0):
     """Returns the default list even if folder_contents is overridden"""
@@ -3701,6 +3712,19 @@
 
 InitializeClass(Base)
 
+try:
+  from Products.CMFCore.interfaces import IContentish
+except ImportError:
+  # We're on CMF 1.5 where the IContentish is not yet bridged as a Zope3
+  # interface, so no need to worry about events here. Remove this "try:" once
+  # we abandon Zope 2.8
+  pass
+else:
+  # suppress CMFCore event machinery from trying to reindex us through events
+  # by removing Products.CMFCore.interfaces.IContentish interface.
+  # We reindex ourselves in manage_afterAdd thank you very much.
+  classImplementsOnly(Base, implementedBy(Base) - IContentish)
+
 class TempBase(Base):
   """
     If we need Base services (categories, edit, etc) in temporary objects




More information about the Erp5-report mailing list