qm :: fields :: EnumerationField :: Class EnumerationField
[hide private]
[frames] | no frames]

Class EnumerationField

source code

object --+            
         |            
     Field --+        
             |        
     TextField --+    
                 |    
       ChoiceField --+
                     |
                    EnumerationField
Known Subclasses:

A field that contains an enumeral value.

The enumeral value is selected from an enumerated set of values. An enumeral field uses the following properties:

enumeration -- A mapping from enumeral names to enumeral values. Names are converted to strings, and values are stored as integers.

ordered -- If non-zero, the enumerals are presented to the user ordered by value.

Instance Methods [hide private]
 
__init__(self, name='', default_value=None, enumerals=[], **properties)
Create an enumeration field.
source code
 
GetItems(self)
Return a sequence of enumerals.
source code
 
GetHelp(self)
Generate help text about this field in structured text format.
source code
 
MakeDomNodeForValue(self, value, document)
Generate a DOM element node for a value of this field.
source code
 
GetValueFromDomNode(self, node, attachment_store)
Return a value for this field represented by DOM 'node'.
source code

Inherited from ChoiceField: FormatValueAsHtml, Validate

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__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from Field: form_field_prefix

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, name='', default_value=None, enumerals=[], **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: object.__init__

GetItems(self)

source code 

Return a sequence of enumerals.

returns -- A sequence consisting of string enumerals objects, in the appropriate order.

Overrides: ChoiceField.GetItems

GetHelp(self)

source code 

Generate help text about this field in structured text format.

Overrides: Field.GetHelp
(inherited documentation)

MakeDomNodeForValue(self, value, document)

source code 

Generate a DOM element node for a value of this field.

'value' -- The value to represent.

'document' -- The containing DOM document node.

Overrides: Field.MakeDomNodeForValue
(inherited documentation)

GetValueFromDomNode(self, node, attachment_store)

source code 

Return a value for this field represented by DOM 'node'.

This method does not validate the value for this particular instance; it only makes sure the node is well-formed, and returns a value of the correct Python type.

'node' -- The DOM node that is being evaluated.

'attachment_store' -- For attachments, the store that should be used.

If the 'node' is incorrectly formed, this method should raise an exception.

Overrides: Field.GetValueFromDomNode
(inherited documentation)