Package qm :: Module fields :: Class BooleanField
[hide private]
[frames] | no frames]

Class BooleanField
source code

object --+                
         |                
     Field --+            
             |            
     TextField --+        
                 |        
       ChoiceField --+    
                     |    
      EnumerationField --+
                         |
                        BooleanField

A field containing a boolean value.

The enumeration contains two values: true and false.

Instance Methods [hide private]
  __init__(self, name="", default_value=None, **properties)
Create an enumeration field.
  Validate(self, value)
Validate a field value.

Inherited from EnumerationField: GetHelp, GetItems, GetValueFromDomNode, MakeDomNodeForValue

Inherited from ChoiceField: FormatValueAsHtml

Inherited from TextField: FormatValueAsText, ParseFormValue, ParseTextValue

Inherited from Field: GetBriefDescription, GetDefaultValue, GetDescription, GetHtmlFormFieldName, GetHtmlHelp, GetName, GetSubfields, GetTitle, IsComputed, IsHidden, IsReadOnly, SetName, __repr__

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__


Class Variables [hide private]

Inherited from Field: form_field_prefix

Inherited from object: __class__


Method Details [hide private]

__init__(self, name="", default_value=None, **properties)
(Constructor)

source code 

Create an enumeration field.

'enumerals' -- A sequence of strings of available enumerals.

'default_value' -- The default value for this enumeration. If 'None', the first enumeral is used.
Overrides: EnumerationField.__init__
(inherited documentation)

Validate(self, value)

source code 

Validate a field value.

For an acceptable type and value, return the representation of 'value' in the underlying field storage.

'value' -- A value to validate for this field.

returns -- If the 'value' is valid, returns 'value' or an equivalent "canonical" version of 'value'. (For example, this function may search a hash table and return an equivalent entry from the hash table.)

This function must raise an exception if the value is not valid. The string representation of the exception will be used as an error message in some situations.

Implementations of this method must be idempotent.
Overrides: ChoiceField.Validate