[CMF-checkins] CVS: CMF/CMFTopic - DateCriteria.py:1.9 SimpleIntCriterion.py:1.12

Yvo Schubbe y.2004_ at wcm-solutions.de
Thu Feb 19 10:59:36 EST 2004


Update of /cvs-repository/CMF/CMFTopic
In directory cvs.zope.org:/tmp/cvs-serv29063/CMFTopic

Modified Files:
	DateCriteria.py SimpleIntCriterion.py 
Log Message:
- replaced deprecated _usage parameters


=== CMF/CMFTopic/DateCriteria.py 1.8 => 1.9 ===
--- CMF/CMFTopic/DateCriteria.py:1.8	Mon Dec  1 08:55:45 2003
+++ CMF/CMFTopic/DateCriteria.py	Thu Feb 19 10:59:04 2004
@@ -15,16 +15,16 @@
 $Id$
 """
 
-from Products.CMFTopic.AbstractCriterion import AbstractCriterion
-from Products.CMFTopic.interfaces import Criterion
-from Products.CMFTopic.Topic import Topic
-from Products.CMFTopic import TopicPermissions
+from AccessControl import ClassSecurityInfo
+from DateTime.DateTime import DateTime
+from Globals import InitializeClass
 
 from Products.CMFCore.CMFCorePermissions import View
 
-from AccessControl import ClassSecurityInfo
-from DateTime.DateTime import DateTime
-import Globals
+from Products.CMFTopic import TopicPermissions
+from Products.CMFTopic.AbstractCriterion import AbstractCriterion
+from Products.CMFTopic.interfaces import Criterion
+from Products.CMFTopic.Topic import Topic
 
 
 class FriendlyDateCriterion( AbstractCriterion ):
@@ -108,10 +108,7 @@
         """
             Return a sequence of items to be used to build the catalog query.
         """
-        result = []
-
         if self.value is not None:
-
             field = self.Field()
             value = self.value
 
@@ -123,25 +120,15 @@
 
             operation = self.operation
             if operation == 'within_day':
-
                 range = ( date.earliestTime(), date.latestTime() )
-                result.append( ( field, range ) )
-
-
-                result.append( ( '%s_usage' % field
-                               , 'range:min:max'
-                               ) )
+                return ( ( field, {'query': range, 'range': 'min:max'} ), )
             else:
-                result.append( ( field, date ) )
-
-
-                result.append( ( '%s_usage' % field
-                            , 'range:%s' % self.operation
-                            ) )
+                return ( ( field, {'query': date, 'range': operation} ), )
+        else:
+            return ()
 
-        return result
+InitializeClass(FriendlyDateCriterion)
 
-Globals.InitializeClass( FriendlyDateCriterion )
 
 # Register as a criteria type with the Topic class
 Topic._criteriaTypes.append( FriendlyDateCriterion )


=== CMF/CMFTopic/SimpleIntCriterion.py 1.11 => 1.12 ===
--- CMF/CMFTopic/SimpleIntCriterion.py:1.11	Mon Dec  1 08:55:45 2003
+++ CMF/CMFTopic/SimpleIntCriterion.py	Thu Feb 19 10:59:04 2004
@@ -15,15 +15,15 @@
 $Id$
 """
 
-from Products.CMFTopic import TopicPermissions
-from Products.CMFTopic.AbstractCriterion import AbstractCriterion
-from Products.CMFTopic.Topic import Topic
-from Products.CMFTopic.interfaces import Criterion
+from AccessControl import ClassSecurityInfo
+from Globals import InitializeClass
 
 from Products.CMFCore.CMFCorePermissions import View
 
-from Globals import InitializeClass
-from AccessControl import ClassSecurityInfo
+from Products.CMFTopic import TopicPermissions
+from Products.CMFTopic.AbstractCriterion import AbstractCriterion
+from Products.CMFTopic.interfaces import Criterion
+from Products.CMFTopic.Topic import Topic
 
 
 class SimpleIntCriterion( AbstractCriterion ):
@@ -116,15 +116,11 @@
         """
         if self.value is None:
             return ()
-
-        result = [ ( self.Field(), self.value ) ]
-
-        if self.direction is not None:
-            result.append( ( '%s_usage' % self.Field()
-                           , 'range:%s' % self.direction
-                           ) )
-
-        return tuple( result )
+        elif self.direction is None:
+            return ( ( self.Field(), self.value ), )
+        else:
+            return ( ( self.Field(), {'query': self.value,
+                                      'range': self.direction} ), )
 
 InitializeClass( SimpleIntCriterion )
 




More information about the CMF-checkins mailing list