Package pyxmpp :: Package jabber :: Module dataforms :: Class Field
[show private | hide private]
[frames | no frames]

Type Field

         object --+    
                  |    
StanzaPayloadObject --+
                      |
                     Field


A data form field.

:Ivariables:
    - `name`: field name.
    - `values`: field values.
    - `value`: field value parsed according to the form type.
    - `label`: field label (human-readable description).
    - `type`: field type ("boolean", "fixed", "hidden", "jid-multi",
      "jid-single", "list-multi", "list-single", "text-multi",
      "text-private" or "text-single").
    - `options`: field options (for "list-multi" or "list-single" fields).
    - `required`: `True` when the field is required.
    - `desc`: natural-language description of the field.
:Types:
    - `name`: `unicode`
    - `values`: `list` of `unicode`
    - `value`: `bool` for "boolean" field, `JID` for "jid-single", `list` of `JID`
      for "jid-multi", `list` of `unicode` for "list-multi" and "text-multi"
      and `unicode` for other field types.
    - `label`: `unicode`
    - `type`: `str`
    - `options`: `Option`
    - `required`: `boolean`
    - `desc`: `unicode`

Method Summary
  __init__(self, name, values, field_type, label, options, required, desc, value)
Initialize a `Field` object.
  __getattr__(self, name)
  __setattr__(self, name, value)
  add_option(self, values, label)
Add an option for the field.
  complete_xml_element(self, xmlnode, doc)
Complete the XML node with `self` content.
  _new_from_xml(cls, xmlnode)
Create a new `Field` object from an XML element. (Class method)
    Inherited from StanzaPayloadObject
  as_xml(self, parent, doc)
Get the XML representation of `self`.
    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
  __repr__(x)
x.__repr__() <==> repr(x)
  __str__(x)
x.__str__() <==> str(x)

Class Variable Summary
tuple allowed_types = ('boolean', 'fixed', 'hidden', 'jid-mult...
str xml_element_name = 'field'
str xml_element_namespace = 'jabber:x:data'

Instance Method Details

__init__(self, name=None, values=None, field_type=None, label=None, options=None, required=False, desc=None, value=None)
(Constructor)

Initialize a `Field` object.

:Parameters:
    - `name`: field name.
    - `values`: raw field values. Not to be used together with `value`.
    - `field_type`: field type.
    - `label`: field label.
    - `options`: optional values for the field.
    - `required`: `True` if the field is required.
    - `desc`: natural-language description of the field.
    - `value`: field value or values in a field_type-specific type. May be used only
      if `values` parameter is not provided.
:Types:
    - `name`: `unicode`
    - `values`: `list` of `unicode`
    - `field_type`: `str`
    - `label`: `unicode`
    - `options`: `list` of `Option`
    - `required`: `bool`
    - `desc`: `unicode`
    - `value`: `bool` for "boolean" field, `JID` for "jid-single", `list` of `JID`
      for "jid-multi", `list` of `unicode` for "list-multi" and "text-multi"
      and `unicode` for other field types.
Overrides:
__builtin__.object.__init__

add_option(self, values, label)

Add an option for the field.

:Parameters:
    - `label`: option label (human-readable description).
    - `values`: option values.
:Types:
    - `label`: `unicode`
    - `values`: `list` of `unicode`

complete_xml_element(self, xmlnode, doc)

Complete the XML node with `self` content.

:Parameters:
    - `xmlnode`: XML node with the element being built. It has already
      right name and namespace, but no attributes or content.
    - `doc`: document to which the element belongs.
:Types:
    - `xmlnode`: `libxml2.xmlNode`
    - `doc`: `libxml2.xmlDoc`
Overrides:
pyxmpp.objects.StanzaPayloadObject.complete_xml_element

Class Method Details

_new_from_xml(cls, xmlnode)

Create a new `Field` object from an XML element.

:Parameters:
    - `xmlnode`: the XML element.
:Types:
    - `xmlnode`: `libxml2.xmlNode`

:return: the object created.
:returntype: `Field`

Class Variable Details

allowed_types

Type:
tuple
Value:
('boolean',
 'fixed',
 'hidden',
 'jid-multi',
 'jid-single',
 'list-multi',
 'list-single',
 'text-multi',
...                                                                    

xml_element_name

Type:
str
Value:
'field'                                                                

xml_element_namespace

Type:
str
Value:
'jabber:x:data'                                                        

Generated by Epydoc 2.1 on Wed May 31 22:37:00 2006 http://epydoc.sf.net