pyxmpp :: jid :: JID :: Class JID

[hide private]

# Class JID

source code

    object --+
             |
            JID

JID.

JID objects are immutable. They are also cached for better performance.

Instance Methods | [hide private]

__setattr__(self, name, value) x.__setattr__('name', value) <==> x.name = value | source code

__from_unicode(self, s, check=True) Initialize JID object from Unicode string. | source code

__set_node(self, s) Initialize self.node | source code

__set_domain(self, s) Initialize self.domain | source code

__set_resource(self, s) Initialize self.resource | source code

__str__(self) str(x) | source code

__unicode__(self) | source code

__repr__(self) repr(x) | source code

as_utf8(self) UTF-8 encoded JID representation. | source code

as_string(self) UTF-8 encoded JID representation. | source code

as_unicode(self) Unicode string JID representation. | source code

bare(self) Make bare JID made by removing resource from current `self`. | source code

__eq__(self, other) | source code

__ne__(self, other) | source code

__cmp__(self, other) | source code

__hash__(self) hash(x) | source code

Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__init__`, `__reduce__`, `__reduce_ex__`, `__sizeof__`, `__subclasshook__`

Static Methods | [hide private]

a new object with type S, a subtype of T

__new__(cls, node_or_jid=None, domain=None, resource=None, check=True) Create a new JID object or take one from the cache. | source code

Class Variables | [hide private]

| cache = `<WeakValueDictionary at 158224268>`

Instance Variables | [hide private]

| domain domain part of the JID
| node node part of the JID
| resource resource part of the JID

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __new__(cls, node_or_jid=None, domain=None, resource=None, check=True)
Static Method

source code

Create a new JID object or take one from the cache.

Parameters:
  - `node_or_jid` - node part of the JID, JID object to copy or Unicode representation of the JID.
  - `domain` - domain part of the JID
  - `resource` - resource part of the JID
  - `check` - if `False` then JID is not checked for specifiaction compliance.
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

### __setattr__(self, name, value)

source code

x.__setattr__('name', value) <==> x.name = value

Overrides: object.__setattr__
  (inherited documentation)

### __from_unicode(self, s, check=True)

source code

Initialize JID object from Unicode string.

Parameters:
  - `s` - the JID string
  - `check` - when `False` then the JID is not checked for specification compliance.

### __set_node(self, s)

source code

Initialize self.node

Parameters:
  - `s` (unicode) - Node part of the JID
Raises:
  - `JIDError` - if the node name is too long.
  - `pyxmpp.xmppstringprep.StringprepError` - if the node name fails Nodeprep preparation.

### __set_domain(self, s)

source code

Initialize self.domain

Parameters:
  - `s` - Unicode or UTF-8 domain part of the JID
Raises:
  - `JIDError` - if the domain name is too long.

### __set_resource(self, s)

source code

Initialize self.resource

Parameters:
  - `s` - Unicode or UTF-8 resource part of the JID
Raises:
  - `JIDError` - if the resource name is too long.
  - `pyxmpp.xmppstringprep.StringprepError` - if the node name fails Resourceprep preparation.

### __str__(self)
(Informal representation operator)

source code

str(x)

Overrides: object.__str__
  (inherited documentation)

### __repr__(self)
(Representation operator)

source code

repr(x)

Overrides: object.__repr__
  (inherited documentation)

### as_utf8(self)

source code

UTF-8 encoded JID representation.

Returns:
  UTF-8 encoded JID.

### as_string(self)

source code

UTF-8 encoded JID representation.

Deprecated Always use Unicode objects, or as_utf8 if you really want.

Returns:
  UTF-8 encoded JID.

### as_unicode(self)

source code

Unicode string JID representation.

Returns:
  JID as Unicode string.

### bare(self)

source code

Make bare JID made by removing resource from current `self`.

Returns:
  new JID object without resource part.

### __hash__(self)
(Hashing function)

source code

hash(x)

Overrides: object.__hash__
  (inherited documentation)