[zopeorg-checkins] CVS: Products/CMFDateIndexes - RSCatalogTool.py:1.2

Martijn Pieters mj at zope.com
Mon Mar 11 14:32:36 EST 2002


Update of /cvs-zopeorg/Products/CMFDateIndexes
In directory cvs.zope.org:/tmp/cvs-serv12333

Modified Files:
	RSCatalogTool.py 
Log Message:
Make indexes that contain dates, DateIndexes.



=== Products/CMFDateIndexes/RSCatalogTool.py 1.1 => 1.2 ===
 from DateTime.DateTime import DateTime
 
+DATE_INDEXES = 'Date effective expires created'.split()
 
 class RSCatalogTool( CatalogTool ):
     """
@@ -17,11 +18,13 @@
     def enumerateIndexes( self ):
         #   Return a list of ( index_name, type ) pairs for the initial
         #   index set.
-        return ( CatalogTool.enumerateIndexes( self )
-               + ( ( 'effectiveRange', 'DateRangeIndex' )
-                 ,
-                 )
-               )
+        idxs = CatalogTool.enumerateIndexes(self)
+        new = ()
+        for name, type in idxs:
+            if name in DATE_INDEXES: type = 'DateIndex'
+            new += ((name, type),)
+
+        return new + (('effectiveRange', 'DateRangeIndex'),)
 
     def _initIndexes( self ):
 





More information about the zopeorg-checkins mailing list