pyxmpp.jabber.delay.Delay

Package pyxmpp :: Package jabber :: Module delay :: Class Delay |
[show private | hide private]
[frames | no frames]

## Type Delay

             object --+
                      |
    StanzaPayloadObject --+
                          |
                         Delay

Delayed delivery tag.

Represents 'jabber:x:delay' (JEP-0091) element of a Jabber stanza.

Method Summary
| ``__init__`(self, node_or_datetime, delay_from, reason, utc)` Initialize the Delay object.
| `__cmp__(self, other)`
| `__str__(self)`
| ``complete_xml_element`(self, xmlnode, _unused)` Complete the XML node with `self` content.
| ``from_xml`(self, xmlnode)` Initialize Delay object from an XML node.
`datetime.datetime` | ``get_datetime_local`(self)` Get the timestamp as a local time.
`datetime.datetime` | ``get_datetime_utc`(self)` Get the timestamp as a UTC.
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)
| ``__setattr__`(...)` x.__setattr__('name', value) <==> x.name = value

Instance Variable Summary
| `delay_from`: the "from" value of the delay element
| `reason`: the "reason" (content) of the delay element
| `timestamp`: the UTC timestamp as naive datetime object

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

Method Details

### __init__(self, node_or_datetime, delay_from=None, reason=None, utc=True) (Constructor) Initialize the Delay object. Parameters: `node_or_datetime` - an XML node to parse or the timestamp. (type=`libxml2.xmlNode` or `datetime.datetime`) `delay_from` - JID of the entity which adds the delay mark (when `node_or_datetime` is a timestamp). (type=`pyxmpp.JID`) `reason` - reason of the delay (when `node_or_datetime` is a timestamp). (type=`unicode`) `utc` - if `True` then the timestamp is assumed to be UTC, otherwise it is assumed to be local time. (type=`bool`) Overrides: `__builtin__.object.__init__`

### complete_xml_element(self, xmlnode, _unused) Complete the XML node with `self` content. Should be overriden in classes derived from `StanzaPayloadObject`. Parameters: `xmlnode` - XML node with the element being built. It has already right name and namespace, but no attributes or content. (type=`libxml2.xmlNode`) `_unused` - document to which the element belongs. (type=`libxml2.xmlDoc`) Overrides: `pyxmpp.objects.StanzaPayloadObject.complete_xml_element`

### from_xml(self, xmlnode) Initialize Delay object from an XML node. Parameters: `xmlnode` - the jabber:x:delay XML element. (type=`libxml2.xmlNode`)

### get_datetime_local(self) Get the timestamp as a local time. Returns: the timestamp of the delay element represented in the local timezone. (type=`datetime.datetime`)

### get_datetime_utc(self) Get the timestamp as a UTC. Returns: the timestamp of the delay element represented in UTC. (type=`datetime.datetime`)

Instance Variable Details

### delay_from the "from" value of the delay element

### reason the "reason" (content) of the delay element

### timestamp the UTC timestamp as naive datetime object

Class Variable Details

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

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