Package pyxmpp :: Module xmppstringprep :: Class Profile

[hide private]

# Class Profile

source code

Base class for stringprep profiles.

Instance Methods | [hide private]

__init__(self, unassigned, mapping, normalization, prohibited, bidi=1) Initialize Profile object. | source code

prepare(self, data) Complete string preparation procedure for 'stored' strings. | source code

prepare_query(self, s) Complete string preparation procedure for 'query' strings. | source code

map(self, s) Mapping part of string preparation. | source code

prohibit(self, s) Checks for prohibited characters. | source code

check_unassigned(self, s) Checks for unassigned character codes. | source code

check_bidi(self, s) Checks if sting is valid for bidirectional printing. | source code

Class Variables | [hide private]

| cache_items = ``[``]``

Method Details | [hide private]

### __init__(self, unassigned, mapping, normalization, prohibited, bidi=1)
(Constructor)

source code

Initialize Profile object.

Parameters:
  - `unassigned` - : the lookup table with unassigned codes
  - `mapping` - : the lookup table with character mappings
  - `normalization` - : the normalization function
  - `prohibited` - : the lookup table with prohibited characters
  - `bidi` - : if True then bidirectional checks should be done

### prepare(self, data)

source code

Complete string preparation procedure for 'stored' strings. (includes checks for unassigned codes)

Parameters:
  - `data` - : Unicode string to prepare.
Returns:
  prepared string
Raises:
  - `StringprepError` - if the preparation fails

### prepare_query(self, s)

source code

Complete string preparation procedure for 'query' strings. (without checks for unassigned codes)

Parameters:
  - `s` - : Unicode string to prepare.
Returns:
  prepared string
Raises:
  - `StringprepError` - if the preparation fails