Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Static Private Attributes
CMFTopic.SimpleIntCriterion.SimpleIntCriterion Class Reference
Inheritance diagram for CMFTopic.SimpleIntCriterion.SimpleIntCriterion:
Inheritance graph
[legend]
Collaboration diagram for CMFTopic.SimpleIntCriterion.SimpleIntCriterion:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def getEditForm
def getValueString
def edit
def getCriteriaItems

Public Attributes

 id
 field
 value
 direction

Static Public Attributes

string meta_type = 'Integer Criterion'
tuple security = ClassSecurityInfo()
string MINIMUM = 'min'
string MAXIMUM = 'max'
string MINMAX = 'min:max'

Static Private Attributes

 __implements__ = z2ICriterion
tuple _editableAttributes = ( 'value', 'direction' )

Detailed Description

    Represent a simple field-match for an integer value, including
    catalog range searches.

Definition at line 30 of file SimpleIntCriterion.py.


Constructor & Destructor Documentation

def CMFTopic.SimpleIntCriterion.SimpleIntCriterion.__init__ (   self,
  id,
  field 
)

Definition at line 49 of file SimpleIntCriterion.py.

00049 
00050     def __init__(self, id, field):
00051         self.id = id
00052         self.field = field
00053         self.value = self.direction = None


Member Function Documentation

def CMFTopic.SimpleIntCriterion.SimpleIntCriterion.edit (   self,
  value,
  direction = None 
)
    Update the value to be filtered, and the "direction" qualifier.

Definition at line 83 of file SimpleIntCriterion.py.

00083 
00084     def edit( self, value, direction=None ):
00085         """
00086             Update the value to be filtered, and the "direction" qualifier.
00087         """
00088 
00089         if type( value ) == type( '' ):
00090            value = value.strip()
00091 
00092         if not value:
00093             # An empty string was passed in, which evals to None
00094             self.value = self.direction = None
00095 
00096         elif direction:
00097 
00098             if direction == self.MINMAX:
00099 
00100                 if type( value ) == type( '' ):
00101                     minimum, maximum = value.split(' ')
00102                 else:
00103                     minimum, maximum = value
00104 
00105                 self.value = ( int( minimum ), int( maximum ) )
00106 
00107             else:
00108                 self.value = int( value )
00109 
00110             self.direction = direction
00111 
00112         else:
00113             self.value = int( value )
00114             self.direction = None

Here is the caller graph for this function:

    Return a tuple of query elements to be passed to the catalog
    (used by 'Topic.buildQuery()').

Definition at line 116 of file SimpleIntCriterion.py.

00116 
00117     def getCriteriaItems( self ):
00118         """
00119             Return a tuple of query elements to be passed to the catalog
00120             (used by 'Topic.buildQuery()').
00121         """
00122         if self.value is None:
00123             return ()
00124         elif self.direction is None:
00125             return ( ( self.Field(), self.value ), )
00126         else:
00127             return ( ( self.Field(), {'query': self.value,
00128                                       'range': self.direction} ), )
00129 
00130 InitializeClass( SimpleIntCriterion )
00131 
00132 
00133 # Register as a criteria type with the Topic class
00134 Topic._criteriaTypes.append( SimpleIntCriterion )

Here is the call graph for this function:

    Return the name of skin method which renders the form
    used to edit this kind of criterion.

Definition at line 55 of file SimpleIntCriterion.py.

00055 
00056     def getEditForm( self ):
00057         """
00058             Return the name of skin method which renders the form
00059             used to edit this kind of criterion.
00060         """
00061         return 'sic_edit'

    Return a string representation of the value for which this
    criterion filters.

Definition at line 63 of file SimpleIntCriterion.py.

00063 
00064     def getValueString( self ):
00065         """
00066             Return a string representation of the value for which this
00067             criterion filters.
00068         """
00069         if self.value is None:
00070             return ''
00071 
00072         if self.direction == self.MINMAX:
00073 
00074             value = self.value
00075 
00076             if type( value ) is not type( () ):
00077                 value = ( value, value )
00078 
00079             return '%s %s' % value
00080 
00081         return str( self.value )


Member Data Documentation

Definition at line 38 of file SimpleIntCriterion.py.

Definition at line 43 of file SimpleIntCriterion.py.

Definition at line 52 of file SimpleIntCriterion.py.

Definition at line 51 of file SimpleIntCriterion.py.

Definition at line 50 of file SimpleIntCriterion.py.

Definition at line 46 of file SimpleIntCriterion.py.

string CMFTopic.SimpleIntCriterion.SimpleIntCriterion.meta_type = 'Integer Criterion' [static]

Definition at line 40 of file SimpleIntCriterion.py.

Definition at line 45 of file SimpleIntCriterion.py.

Definition at line 47 of file SimpleIntCriterion.py.

tuple CMFTopic.SimpleIntCriterion.SimpleIntCriterion.security = ClassSecurityInfo() [static]

Definition at line 42 of file SimpleIntCriterion.py.

Definition at line 52 of file SimpleIntCriterion.py.


The documentation for this class was generated from the following file: