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

Type EnumerationField

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

Known Subclasses:
BooleanField, OutcomeField

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.
Method Summary
  __init__(self, name, default_value, enumerals, **properties)
Create an enumeration field.
  GetHelp(self)
Generate help text about this field in structured text format.
  GetItems(self)
Return a sequence of enumerals.
  GetValueFromDomNode(self, node, attachment_store)
Return a value for this field represented by DOM 'node'.
  MakeDomNodeForValue(self, value, document)
Generate a DOM element node for a value of this field.
    Inherited from ChoiceField
  FormatValueAsHtml(self, server, value, style, name)
Return an HTML rendering of a 'value' for this field.
  Validate(self, value)
Validate a field value.
    Inherited from TextField
  FormatValueAsText(self, value, columns)
Return a plain text rendering of a 'value' for this field.
  ParseFormValue(self, request, name, attachment_stores)
Convert a value submitted from an HTML form.
  ParseTextValue(self, value)
Parse a value represented as a string.
    Inherited from Field
  __repr__(self)
  GetBriefDescription(self)
Return a brief description of this field.
  GetDefaultValue(self)
Return the default value for this field.
  GetDescription(self)
Return a description of this field.
  GetHtmlFormFieldName(self)
Return the form field name corresponding this field.
  GetHtmlHelp(self, edit)
Generate help text about this field in HTML format.
  GetName(self)
Return the name of the field.
  GetSubfields(self)
Returns the sequence of subfields contained in this field.
  GetTitle(self)
Return the user-friendly title of the field.
  IsComputed(self)
Returns true if this field is computed automatically.
  IsHidden(self)
Returns true if this 'Field' should be hidden from users.
  IsReadOnly(self)
Returns true if this 'Field' cannot be modified by users.
  SetName(self, name)
Set the name of the field.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Class Variable Summary
    Inherited from Field
str form_field_prefix = '_field_'

Method Details

__init__(self, name='', default_value=None, enumerals=[], **properties)
(Constructor)

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:
qm.fields.TextField.__init__

GetHelp(self)

Generate help text about this field in structured text format.
Overrides:
qm.fields.TextField.GetHelp (inherited documentation)

GetItems(self)

Return a sequence of enumerals.

returns -- A sequence consisting of string enumerals objects, in the appropriate order.
Overrides:
qm.fields.ChoiceField.GetItems

GetValueFromDomNode(self, node, attachment_store)

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:
qm.fields.TextField.GetValueFromDomNode (inherited documentation)

MakeDomNodeForValue(self, value, document)

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

'value' -- The value to represent.

'document' -- The containing DOM document node.
Overrides:
qm.fields.TextField.MakeDomNodeForValue (inherited documentation)

Generated by Epydoc 2.1 on Thu Sep 27 15:48:59 2007 http://epydoc.sf.net