[CMF-checkins] CVS: Products/CMFCalendar/Extensions - Install.py:1.3
andrew@cvs.baymountain.com
andrew@cvs.baymountain.com
Tue, 24 Jul 2001 13:47:01 -0400
Update of /cvs-repository/Products/CMFCalendar/Extensions
In directory cvs.zope.org:/tmp/cvs-serv19009/Extensions
Modified Files:
Install.py
Log Message:
*Added check and support for Zope2.4 catalog changes.
=== Products/CMFCalendar/Extensions/Install.py 1.2 => 1.3 ===
from cStringIO import StringIO
import string
+from Acquisition import aq_base
def install(self):
" Register the CMF Event with portal_types and friends "
- out = StringIO()
catalog = getToolByName(self, 'portal_catalog')
- c_catalog = catalog._catalog
- c_catalog.addIndex('start', 'FieldIndex')
- c_catalog.addIndex('end', 'FieldIndex')
- c_catalog.addColumn('start')
- c_catalog.addColumn('end')
+ base = aq_base(catalog)
+ if hasattr(base, 'addIndex'):
+ # Zope 2.4
+ addIndex = catalog.addIndex
+ else:
+ # Zope 2.3 and below
+ addIndex = catalog._catalog.addIndex
+ if hasattr(base, 'addColumn'):
+ # Zope 2.4
+ addColumn = catalog.addColumn
+ else:
+ # Zope 2.3 and below
+ addColumn = catalog._catalog.addColumn
+ out = StringIO()
+ addIndex('start', 'FieldIndex')
+ addIndex('end', 'FieldIndex')
+ addColumn('start')
+ addColumn('end')
typestool = getToolByName(self, 'portal_types')
skinstool = getToolByName(self, 'portal_skins')
metadatatool = getToolByName(self, 'portal_metadata')