Package xmpp :: Module protocol :: Class DataReported
[hide private]
[frames] | no frames]

Class DataReported

source code


This class is used in the DataForm class to describe the 'reported data field' data items which are used in 'multiple item form results' (as described in XEP-0004). Represents the fields that will be returned from a search. This information is useful when you try to use the jabber:iq:search namespace to return dynamic form information.

Instance Methods [hide private]
 
__init__(self, node=None)
Create new empty 'reported data' field.
source code
 
getField(self, name)
Return the datafield object with name 'name' (if exists).
source code
 
setField(self, name, typ=None, label=None)
Create if nessessary or get the existing datafield object with name 'name' and return it.
source code
 
asDict(self)
Represent dataitem as simple dictionary mapping of datafield names to their values.
source code
 
__getitem__(self, name)
Simple dictionary interface for getting datafields values by their names.
source code
 
__setitem__(self, name, val)
Simple dictionary interface for setting datafields values by their names.
source code

Inherited from simplexml.Node: __delitem__, __getattr__, __str__, addChild, addData, clearData, delAttr, delChild, getAttr, getAttrs, getCDATA, 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, node=None)
(Constructor)

source code 

Create new empty 'reported data' field. However, note that, according XEP-0004: * It MUST contain one or more DataFields. * Contained DataFields SHOULD possess a 'type' and 'label' attribute in addition to 'var' attribute * Contained DataFields SHOULD NOT contain a <value/> element. Alternatively other XML object can be passed in as the 'node' parameted to replicate it as a new dataitem.

Overrides: object.__init__

setField(self, name, typ=None, label=None)

source code 

Create if nessessary or get the existing datafield object with name 'name' and return it. If created, attributes 'type' and 'label' are applied to new datafield.

__getitem__(self, name)
(Indexing operator)

source code 

Simple dictionary interface for getting datafields values by their names.

Overrides: simplexml.Node.__getitem__

__setitem__(self, name, val)
(Index assignment operator)

source code 

Simple dictionary interface for setting datafields values by their names.

Overrides: simplexml.Node.__setitem__