Package nbxmpp :: Module protocol :: Class DataField

[hide private]
[frames] | no frames]

# Class DataField

source code

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, 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) Return in this field a required one | 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. Replaces all previous filed values! If you need to just add a value - use addValue method | source code

addValue(self, val) Add one more value to this field. Used in 'get' iq's or such | 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`: `__contains__`, `__delitem__`, `__getattr__`, `__getitem__`, `__setitem__`, `__str__`, `addChild`, `addData`, `clearData`, `delAttr`, `delChild`, `getAttr`, `getAttrs`, `getChildren`, `getData`, `getName`, `getNamespace`, `getParent`, `getPayload`, `getTag`, `getTagAttr`, `getTagData`, `getTags`, `has_attr`, `iterTags`, `lookup_nsp`, `setAttr`, `setData`, `setName`, `setNamespace`, `setParent`, `setPayload`, `setTag`, `setTagAttr`, `setTagData`

Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Class Variables | [hide private]

Inherited from `simplexml.Node`: `FORCE_NODE_RECREATION`

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, name=None, value=None, typ=None, required=0, 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: object.__init__

### setRequired(self, req=1)

source code

Change the state of the 'required' flag

### isRequired(self)

source code

Return in this field a required one

### setDesc(self, desc)

source code

Set the description of this field

### getDesc(self)

source code

Return the description of this field

### setValue(self, val)

source code

Set the value of this field

### getValue(self)

source code

### 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

### getValues(self)

source code

Return the list of values associated with this field

### getOptions(self)

source code

Return label-option pairs list associated with this field

### setOptions(self, lst)

source code

Set label-option pairs list associated with this field

### addOption(self, opt)

source code

Add one more label-option pair to this field

### getType(self)

source code

Get type of this field

### setType(self, val)

source code

Set type of this field

### getVar(self)

source code

Get 'var' attribute value of this field

### setVar(self, val)

source code

Set 'var' attribute value of this field