Avoid inheriting index_html from the ERP5 site, restoring behaviour lost on...

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)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29876 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent efa033f6
...@@ -80,6 +80,8 @@ from Products.ERP5Type.Accessor.TypeDefinition import asDate ...@@ -80,6 +80,8 @@ from Products.ERP5Type.Accessor.TypeDefinition import asDate
from Products.ERP5Type.Message import Message from Products.ERP5Type.Message import Message
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from zope.interface import classImplementsOnly, implementedBy
from string import join from string import join
import sys, re import sys, re
from Products.ERP5Type.PsycoWrapper import psyco from Products.ERP5Type.PsycoWrapper import psyco
...@@ -2620,6 +2622,15 @@ class Base( CopyContainer, ...@@ -2620,6 +2622,15 @@ class Base( CopyContainer,
security.declareProtected(Permissions.View, '__call__') security.declareProtected(Permissions.View, '__call__')
__call__ = view __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') security.declareProtected(Permissions.View, 'list')
def list(self, reset=0): def list(self, reset=0):
"""Returns the default list even if folder_contents is overridden""" """Returns the default list even if folder_contents is overridden"""
...@@ -3701,6 +3712,19 @@ class Base( CopyContainer, ...@@ -3701,6 +3712,19 @@ class Base( CopyContainer,
InitializeClass(Base) 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): class TempBase(Base):
""" """
If we need Base services (categories, edit, etc) in temporary objects If we need Base services (categories, edit, etc) in temporary objects
......
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