Class: Field | qm/fields.py | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A
|
FormatValueAsText
|
| FormatValueAsText ( self, value, columns=72, ) Return a plain text rendering of a
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GetBriefDescription | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GetBriefDescription ( self ) Return a brief description of this field.This description is used when prompting for input, or when displaying the current value of the field. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GetDefaultValue | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GetDefaultValue ( self ) Return the default value for this field. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GetDescription | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GetDescription ( self ) Return a description of this field.This description is used when displaying detailed help information about the field. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GetHelp | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GetHelp ( self ) Generate help text about this field in structured text format.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GetHtmlFormFieldName | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GetHtmlFormFieldName ( self ) Return the form field name corresponding this field.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GetHtmlHelp | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GetHtmlHelp ( self, edit=0 ) Generate help text about this field in HTML format.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GetName | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GetName ( self ) Return the name of the field. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GetSubfields | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GetSubfields ( self ) Returns the sequence of subfields contained in this field.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GetTitle | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GetTitle ( self ) Return the user-friendly title of the field. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GetValueFromDomNode | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GetValueFromDomNode ( self, node, attachment_store, ) Return a value for this field represented by DOM
|
Exceptions | |
---|---|
NotImplementedError |
IsComputed ( self )
IsHidden ( self )
Field
should be hidden from users.Field
should be hidden from users.
The value of a hidden field is not displayed in the GUI.IsReadOnly ( self )
Field
cannot be modified by users.Field
cannot be modified by users.
The GUI does not allow users to modify a read-only field.MakeDomNodeForValue ( self, value, document, )
value
document
Exceptions | |
---|---|
NotImplementedError |
ParseFormValue ( self, request, name, attachment_stores, )
request
WebRequest
containing a value corresponding
to this field.name
request
.attachment_stores
AttachmentStore
ids
(in the sense of Python's id
built-in) to the
'AttachmentStore's themselves.(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.ParseTextValue ( self, value )
value
Validate
to ensure that it is valid
before it is returned.Exceptions | |
---|---|
NotImplemented |
Validate ( self, value )
For an acceptable type and value, return the representation of
value
in the underlying field storage.
value
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.
Exceptions | |
---|---|
NotImplementedError |
__init__ ( self, name, default_value, title="", description="", hidden="false", read_only="false", computed="false", )
name
default_value
title
description
description
must be provided as structured text. The
first line of the structured text must be a one-sentence
description of the field; that line is extracted by
GetBriefDescription
.hidden
read_only
computed
The boolean parameters (such as hidden
) use the convention
that true is represented by the string '"true"'; any other value
is false. This convention is a historical artifact.
__repr__ ( self )