[CMF-checkins] CVS: Products/CMFCore - CatalogTool.py:1.21

Jens Vagelpohl jens@zope.com
Thu, 29 Nov 2001 17:09:19 -0500


Update of /cvs-repository/Products/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv7401/CMFCore

Modified Files:
	CatalogTool.py 
Log Message:
The code to generate the expires and effective headers for catalog queries
was broken



=== Products/CMFCore/CatalogTool.py 1.20 => 1.21 ===
         if not _checkPermission(
             CMFCorePermissions.AccessInactivePortalContent, self ):
+            base = aq_base( self )
             now = DateTime()
-            kw[ 'effective' ] = { 'query' : now, 'usage' : 'range:max' }
-            kw[ 'expires'   ] = { 'query' : now, 'usage' : 'range:min' }
+            if hasattr( base, 'addIndex' ):   # Zope 2.4 and above
+                kw[ 'effective' ] = { 'query' : now, 'range' : 'max' }
+                kw[ 'expires'   ] = { 'query' : now, 'range' : 'min' }
+            else:                             # Zope 2.3
+                kw[ 'effective'      ] = kw[ 'expires' ] = now
+                kw[ 'effective_usage'] = 'range:max'
+                kw[ 'expires_usage'  ] = 'range:min'
 
         return apply(ZCatalog.searchResults, (self, REQUEST), kw)