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

Class TextField

source code

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

A field that contains text.

Instance Methods [hide private]
 
__init__(self, name='', default_value='', multiline='false', structured='false', verbatim='false', not_empty_text='false', **properties)
Construct a new 'TextField'.
source code
 
GetHelp(self)
Generate help text about this field in structured text format.
source code
 
FormatValueAsText(self, value, columns=72)
Return a plain text rendering of a 'value' for this field.
source code
 
FormatValueAsHtml(self, server, value, style, name=None)
Return an HTML rendering of a 'value' for this field.
source code
 
MakeDomNodeForValue(self, value, document)
Generate a DOM element node for a value of this field.
source code
 
Validate(self, value)
Validate a field value.
source code
 
ParseFormValue(self, request, name, attachment_stores)
Convert a value submitted from an HTML form.
source code
 
ParseTextValue(self, value)
Parse a value represented as a string.
source code
 
GetValueFromDomNode(self, node, attachment_store)
Return a value for this field represented by DOM 'node'.
source code

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='', multiline='false', structured='false', verbatim='false', not_empty_text='false', **properties)
(Constructor)

source code 

Construct a new 'TextField'.

'multiline' -- If false, a value for this field is a single line of text. If true, multi-line text is allowed.

'structured' -- If true, the field contains structured text.

'verbatim' -- If true, the contents of the field are treated as preformatted text.

'not_empty_text' -- The value of this field is considered invalid if it empty or composed only of whitespace.

'properties' -- A dictionary of other keyword arguments which are provided to the base class constructor.

Overrides: object.__init__

GetHelp(self)

source code 

Generate help text about this field in structured text format.

Overrides: Field.GetHelp
(inherited documentation)

FormatValueAsText(self, value, columns=72)

source code 

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

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

source code 

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: Field.FormatValueAsHtml
(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)

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

ParseFormValue(self, request, name, attachment_stores)

source code 

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

ParseTextValue(self, value)

source code 

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: Field.ParseTextValue
(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)