pyxmpp.jabber.dataforms.Field

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

## Type Field

             object --+
                      |
    StanzaPayloadObject --+
                          |
                         Field

A data form field.

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.
Inherited from StanzaPayloadObject
`libxml2.xmlNode` or `libxml2.xmlDoc` | ``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)

Instance Variable Summary
`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.

Class Variable Summary
`tuple` | `allowed_types` = `('boolean', 'fixed', 'hidden', 'jid-mult...`
`unicode` | `xml_element_name`: name for the XML element provided by the class.
`unicode` | `xml_element_namespace`: namespace URI for the XML element provided by the class.

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. (type=`unicode`) `values` - raw field values. Not to be used together with `value`. (type=`list` of `unicode`) `field_type` - field type. (type=`str`) `label` - field label. (type=`unicode`) `options` - optional values for the field. (type=`list` of `Option`) `required` - `True` if the field is required. (type=`bool`) `desc` - natural-language description of the field. (type=`unicode`) `value` - field value or values in a field_type-specific type. May be used only if `values` parameter is not provided. (type=`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: `values` - option values. (type=`list` of `unicode`) `label` - option label (human-readable description). (type=`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. (type=`libxml2.xmlNode`) `doc` - document to which the element belongs. (type=`libxml2.xmlDoc`) Overrides: `pyxmpp.objects.StanzaPayloadObject.complete_xml_element`

Instance Variable Details

### desc natural-language description of the field. Type: `unicode`

### label field label (human-readable description). Type: `unicode`

### name field name. Type: `unicode`

### options field options (for "list-multi" or "list-single" fields). Type: `Option`

### required `True` when the field is required. Type: `boolean`

### type field type ("boolean", "fixed", "hidden", "jid-multi", "jid-single", "list-multi", "list-single", "text-multi", "text-private" or "text-single"). Type: `str`

### value field value parsed according to the form type. Type: `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.

### values field values. Type: `list` of `unicode`

Class Variable Details

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

    ### xml_element_name name for the XML element provided by the class. Type: `unicode` Value:
        'field'

    ### xml_element_namespace namespace URI for the XML element provided by the class. Type: `unicode` Value:
        'jabber:x:data'