Package xmpp :: Module protocol :: Class DataField

[hide private]
[frames] | no frames]

# Class DataField

source code

    simplexml.Node --+
                     |
                    DataField

This class is used in the DataForm class to describe the single data item. If you are working with jabber:x:data (XEP-0004, XEP-0068, XEP-0122) then you will need to work with instances of this class.

Instance Methods | [hide private]

__init__(self, name=None, value=None, typ=None, required=0, label=None, desc=None, options=`[``]`, node=None) Create new data field of specified name,value and type. | source code

setRequired(self, req=1) Change the state of the 'required' flag. | source code

isRequired(self) Returns in this field a required one. | source code

setLabel(self, label) Set the label of this field. | source code

getLabel(self) Return the label of this field. | source code

setDesc(self, desc) Set the description of this field. | source code

getDesc(self) Return the description of this field. | source code

setValue(self, val) Set the value of this field. | source code

getValue(self) | source code

setValues(self, lst) Set the values of this field as values-list. | source code

addValue(self, val) Add one more value to this field. | source code

getValues(self) Return the list of values associated with this field. | source code

getOptions(self) Return label-option pairs list associated with this field. | source code

setOptions(self, lst) Set label-option pairs list associated with this field. | source code

addOption(self, opt) Add one more label-option pair to this field. | source code

getType(self) Get type of this field. | source code

setType(self, val) Set type of this field. | source code

getVar(self) Get 'var' attribute value of this field. | source code

setVar(self, val) Set 'var' attribute value of this field. | source code

Inherited from `simplexml.Node`: `__delitem__`, `__getattr__`, `__getitem__`, `__setitem__`, `__str__`, `addChild`, `addData`, `clearData`, `delAttr`, `delChild`, `getAttr`, `getAttrs`, `getCDATA`, `getChildren`, `getData`, `getName`, `getNamespace`, `getParent`, `getPayload`, `getTag`, `getTagAttr`, `getTagData`, `getTags`, `has_attr`, `setAttr`, `setData`, `setName`, `setNamespace`, `setParent`, `setPayload`, `setTag`, `setTagAttr`, `setTagData`

Class Variables | [hide private]

Inherited from `simplexml.Node`: `FORCE_NODE_RECREATION`

Method Details | [hide private]

### __init__(self, name=None, value=None, typ=None, required=0, label=None, desc=None, options=`[``]`, node=None)
(Constructor)

source code

Create new data field of specified name,value and type. Also 'required','desc' and 'options' fields can be set. Alternatively other XML object can be passed in as the 'node' parameted to replicate it as a new datafiled.

Overrides: simplexml.Node.__init__

### setValues(self, lst)

source code

Set the values of this field as values-list. Replaces all previous filed values! If you need to just add a value - use addValue method.

### addValue(self, val)

source code

Add one more value to this field. Used in 'get' iq's or such.