pyxmpp.jabber.dataforms.Field

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

# Class Field

source code

                     object --+
                              |
    objects.StanzaPayloadObject --+
                                  |
                                 Field

A data form field.

Instance Methods | [hide private]
__init__(self, name=None, values=None, field_type=None, label=None, options=None, required=False, desc=None, value=None) Initialize a Field object. | source code
__getattr__(self, name) | source code
__setattr__(self, name, value) x.__setattr__('name', value) <==> x.name = value | source code
add_option(self, value, label) Add an option for the field. | source code
complete_xml_element(self, xmlnode, doc) Complete the XML node with `self` content. | source code
Inherited from `objects.StanzaPayloadObject`: `as_xml` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Class Methods | [hide private]
Field |
_new_from_xml(cls, xmlnode) Create a new Field object from an XML element. | source code

Class Variables | [hide private]
`unicode` | xml_element_name = ``'``field``'`` name for the XML element provided by the class.
`unicode` | xml_element_namespace = ``'``jabber:x:data``'`` namespace URI for the XML element provided by the class.
| allowed_types = ``(``'``boolean``'``,` `'``fixed``'``,` `'``hidden``'``,` `'``jid-multi``'``,` `'``j``...``

Instance Variables | [hide private]
`unicode` | desc natural-language description of the field.
`unicode` | label field label (human-readable description).
`unicode` | name field name.
Option | options field options (for "list-multi" or "list-single" fields).
`boolean` | required `True` when the field is required.
`str` | type field type ("boolean", "fixed", "hidden", "jid-multi", "jid-single", "list-multi", "list-single", "text-multi", "text-private" or "text-single").
`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. | value field value parsed according to the form type.
`list` of `unicode` | values field values.

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, name=None, values=None, field_type=None, label=None, options=None, required=False, desc=None, value=None) (Constructor) | source code
Initialize a Field object. Parameters: `name` (`unicode`) - field name. `values` (`list` of `unicode`) - raw field values. Not to be used together with value. `field_type` (`str`) - field type. `label` (`unicode`) - field label. `options` (`list` of Option) - optional values for the field. `required` (`bool`) - `True` if the field is required. `desc` (`unicode`) - natural-language description of the field. `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.) - field value or values in a field_type-specific type. May be used only if values parameter is not provided. Overrides: object.__init__

### __setattr__(self, name, value) | source code
x.__setattr__('name', value) <==> x.name = value Overrides: object.__setattr__ (inherited documentation)

### add_option(self, value, label) | source code
Add an option for the field. Parameters: `value` (`list` of `unicode`) - option values. `label` (`unicode`) - option label (human-readable description).

### complete_xml_element(self, xmlnode, doc) | source code
Complete the XML node with `self` content. Parameters: `xmlnode` (`libxml2.xmlNode`) - XML node with the element being built. It has already right name and namespace, but no attributes or content. `doc` (`libxml2.xmlDoc`) - document to which the element belongs. Overrides: objects.StanzaPayloadObject.complete_xml_element

### _new_from_xml(cls, xmlnode) Class Method | source code
Create a new Field object from an XML element. Parameters: `xmlnode` (`libxml2.xmlNode`) - the XML element. Returns: Field the object created.

Class Variable Details | [hide private]

  ### allowed_types Value:
      ('boolean',
       'fixed',
       'hidden',
       'jid-multi',
       'jid-single',
       'list-multi',
       'list-single',
       'text-multi',
      ...