Package pyxmpp :: Package jabber :: Module register :: Class Register

[hide private]

# Class Register

source code

                     object --+
                              |
    objects.StanzaPayloadObject --+
                                  |
                                 Register

Delayed delivery tag.

Represents 'jabber:iq:register' (JEP-0077) element of a Jabber <iq/> stanza.

Please note that it is recommended to use get_form and submit_form records instead of accessing the form and legacy fields directly. This way both legacy and Data Forms registration would work transparently to the application.

Instance Methods | [hide private]

__init__(self, xmlnode=None) Initialize the Register object. | source code

__from_xml(self, xmlnode) Initialize Register from an XML node. | source code

complete_xml_element(self, xmlnode, doc) Complete the XML node with `self` content. | source code

pyxmpp.jabber.dataforms.Form

get_form(self, form_type=`'``form``'`) Return Data Form for the Register object. | source code

Register

submit_form(self, form) Make Register object for submitting the registration form. | source code

Inherited from `objects.StanzaPayloadObject`: `as_xml` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Class Variables | [hide private]

: `unicode` | xml_element_name = ``'``query``'`` : name for the XML element provided by the class.
: `unicode` | xml_element_namespace = ``'``jabber:iq:register``'`` : namespace URI for the XML element provided by the class.

Instance Variables | [hide private]

: `unicode` | address : Address field (legacy protocol)
: `unicode` | city : City field (legacy protocol)
: `unicode` | date : Date field (legacy protocol)
: `unicode` | email : E-mail field (legacy protocol)
: `unicode` | first : First name field (legacy protocol)
: pyxmpp.jabber.dataforms.Form | form : registration form (when available)
: `unicode` | instrutions : Registration instructions (legacy protocol)
: `unicode` | key : Key field (legacy protocol, obsolete)
: `unicode` | last : Last name field (legacy protocol)
: `unicode` | misc : Misc field (legacy protocol, obsolete)
: `unicode` | name : Name field (legacy protocol)
: `unicode` | nick : Nickname (legacy protocol)
: `unicode` | password : Password (legacy protocol)
: `unicode` | phone : Phone field (legacy protocol)
: `bool` | registered : `True` if entity is already registered
: `True` when the account should be removed | remove : `True` when the account should be removed
: `unicode` | state : State field (legacy protocol)
: `unicode` | text : Text field (legacy protocol, obsolete)
: `unicode` | url : URL field (legacy protocol)
: `unicode` | username : Username field (legacy protocol)
: `unicode` | zip : ZIP code field (legacy protocol)

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, xmlnode=None)
(Constructor)

source code

Initialize the Register object.

Parameters:
  - `xmlnode` (: `libxml2.xmlNode`) - : an optional XML node to parse.
Overrides: object.__init__

### __from_xml(self, xmlnode)

source code

Initialize Register from an XML node.

Parameters:
  - `xmlnode` (: `libxml2.xmlNode`) - : the jabber:x:register XML element.

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

### get_form(self, form_type=`'``form``'`)

source code

Return Data Form for the Register object.

Convert legacy fields to a data form if self.form is `None`, return self.form otherwise.

Parameters:
  - `form_type` (: `unicode`) - : If "form", then a form to fill-in should be returned. If "sumbit", then a form with submitted data.
Returns: pyxmpp.jabber.dataforms.Form
  self.form or a form created from the legacy fields

### submit_form(self, form)

source code

Make Register object for submitting the registration form.

Convert form data to legacy fields if self.form is `None`.

Parameters:
  - `form` - : The form to submit. Its type doesn't have to be "submit" (a "submit" form will be created here), so it could be the form obtained from get_form just with the data entered.
Returns: Register
  new registration element