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

Type SetField

object --+    
         |    
     Field --+
             |
            SetField


A field containing zero or more instances of some other field.

All contents must be of the same field type. A set field may not contain sets.

The default field value is set to an empty set.
Method Summary
  __init__(self, contained, not_empty_set, default_value, **properties)
Create a set field.
  FormatValueAsHtml(self, server, value, style, name)
Return an HTML rendering of a 'value' for this field.
  FormatValueAsText(self, value, columns)
Return a plain text rendering of a 'value' for this field.
  GetHelp(self)
Generate help text about this field in structured text format.
  GetHtmlHelp(self, edit)
Generate help text about this field in HTML format.
  GetSubfields(self)
Returns the sequence of subfields contained in this field.
  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.
  ParseFormValue(self, request, name, attachment_stores)
Convert a value submitted from an HTML form.
  ParseTextValue(self, value)
Parse a value represented as a string.
  Validate(self, value)
Validate a field value.
    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.
  GetName(self)
Return the name of the 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, contained, not_empty_set='false', default_value=None, **properties)
(Constructor)

Create a set field.

The name of the contained field is taken as the name of this field.

'contained' -- An 'Field' instance describing the elements of the set.

'not_empty_set' -- If true, this field may not be empty, i.e. the value of this field must contain at least one element.

raises -- 'ValueError' if 'contained' is a set field.

raises -- 'TypeError' if 'contained' is not a 'Field'.
Overrides:
qm.fields.Field.__init__

FormatValueAsHtml(self, server, value, style, name=None)

Return an HTML rendering of a 'value' for this field.

'server' -- The 'WebServer' in which the HTML will be displayed.

'value' -- The value for this field. May be 'None', which renders a default value (useful for blank forms).

'style' -- The rendering style. Can be "full" or "brief" (both read-only), or "new" or "edit" or "hidden".

'name' -- The name to use for the primary HTML form element containing the value of this field, if 'style' specifies the generation of form elements. If 'name' is 'None', the value returned by 'GetHtmlFormFieldName()' should be used.

returns -- A string containing the HTML representation of 'value'.
Overrides:
qm.fields.Field.FormatValueAsHtml (inherited documentation)

FormatValueAsText(self, value, columns=72)

Return a plain text rendering of a 'value' for this field.

'columns' -- The maximum width of each line of text.

returns -- A plain-text string representing 'value'.
Overrides:
qm.fields.Field.FormatValueAsText (inherited documentation)

GetHelp(self)

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

GetHtmlHelp(self, edit=0)

Generate help text about this field in HTML format.

'edit' -- If true, display information about editing controls for this field.
Overrides:
qm.fields.Field.GetHtmlHelp (inherited documentation)

GetSubfields(self)

Returns the sequence of subfields contained in this field.

returns -- The sequence of subfields contained in this field. If there are no subfields, an empty sequence is returned.
Overrides:
qm.fields.Field.GetSubfields (inherited documentation)

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.Field.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.Field.MakeDomNodeForValue (inherited documentation)

ParseFormValue(self, request, name, attachment_stores)

Convert a value submitted from an HTML form.

'request' -- The 'WebRequest' containing a value corresponding to this field.

'name' -- The name corresponding to this field in the 'request'.

'attachment_stores' -- A dictionary mapping 'AttachmentStore' ids (in the sense of Python's 'id' built-in) to the 'AttachmentStore's themselves.

returns -- A pair '(value, redisplay)'. 'value' is the value for this field, as indicated in 'request'. 'redisplay' is true if and only if the form should be redisplayed, rather than committed. If an error occurs, an exception is thrown.
Overrides:
qm.fields.Field.ParseFormValue (inherited documentation)

ParseTextValue(self, value)

Parse a value represented as a string.

'value' -- A string representing the value.

returns -- The corresponding field value. The value returned should be processed by 'Validate' to ensure that it is valid before it is returned.
Overrides:
qm.fields.Field.ParseTextValue (inherited documentation)

Validate(self, value)

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

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