idnkit.IDNA2008 Class Reference

An instance of IDNA2008 class represents IDNA2008 version of IDNA conversion context. More...

List of all members.

Public Member Functions

def init
 Initializes the instance of IDNA2008 conversion context.
def set_local_check_file
 Reads a code point set for local-check from a file 'filename'.
def encode
 Converts a domain name 'name' to ASCII and returns the result.
def decode
 Converts a domain name 'name' to UTF-8 and returns the result.
def compare
 Compares two domain names.
def check
 Validates a domain name.
def get_unicode_version
 Gets a version of Unicode tables the context instance supports.
def get_idna_table_version
 Gets a version of IDNA tables the context instance supports.
def get_lib_idn_version
 Gets a version of idnkit library.
def get_version
 Returns version information.


Detailed Description

An instance of IDNA2008 class represents IDNA2008 version of IDNA conversion context.

Its main functions are encoding (conversion to ASCII) and decoding (conversion to UTF-8) domain names, according with RFC5894; "Internationalized Domain Names in Applications (IDNA): Protocol".

Note that IDNA2008 class doesn't provide a constructor. To create an IDNA2008 instance, use the create() method of the idnkit module.


Member Function Documentation

def idnkit.IDNA2008.check (   name,
  actions = CHECK_REGIST 
)

Validates a domain name.

It tries to encode 'name' with an action value 'actions'. If succeeded, it returns true. Otherwise, it returns false.

Parameters:
name A domain name to be validated.
actions An Action value to encode 'name'.
Returns:
True if the domain name is valid.
Exceptions:
idnkit.Error Conversion of domain names failed.

def idnkit.IDNA2008.compare (   name1,
  name2,
  actions1 = COMPARE_LOOKUP,
  actions2 = actions1 
)

Compares two domain names.

It encodes domain names 'name1' and 'name2' as the encode() method does, and then compares them. If they are equivalent, it returns true. Otherwise, it returns false. The method performs 'actions1' to encode 'name1', and 'actions2' to encode 'name2' respectively.

Parameters:
name1 A domain name #1.
name2 A domain name #2.
actions1 An Action value to encode 'name1'.
actions2 An Action value to encode 'name2'.
Returns:
True if two domain names are equivalent.
Exceptions:
idnkit.Error Conversion of domain names failed.

def idnkit.IDNA2008.decode (   name,
  actions = DECODE_REGIST 
)

Converts a domain name 'name' to UTF-8 and returns the result.

The argument 'actions' specifies how 'name' is decoded.

Parameters:
actions An action value to decode 'name'.
name A domain name to be decoded.
Returns:
A decoded domain name.
Exceptions:
idnkit.Error Conversion failed.

def idnkit.IDNA2008.encode (   name,
  actions = ENCODE_REGIST 
)

Converts a domain name 'name' to ASCII and returns the result.

The argument 'actions' specifies how 'name' is encoded.

Parameters:
actions An action value to encode 'name'.
name A domain name to be encoded.
Returns:
An encoded domain name.
Exceptions:
idnkit.Error Conversion failed.

def idnkit.IDNA2008.get_idna_table_version (  ) 

Gets a version of IDNA tables the context instance supports.

Returns:
Version (e.g. "rfc5892 (2010-08-04)").

def idnkit.IDNA2008.get_lib_idn_version (  ) 

Gets a version of idnkit library.

Returns:
Version (e.g. "2.0" for idnkit version 2.0).

def idnkit.IDNA2008.get_unicode_version (  ) 

Gets a version of Unicode tables the context instance supports.

Returns:
Version (e.g. "5.2.0" in case of Unicode 5.2.0).

def idnkit.IDNA2008.get_version (  ) 

Returns version information.

It returns a string which consists of a version of Unicode tables, a version of IDNA tables and a version of idnkit library.

Returns:
Version string.

def idnkit.IDNA2008.init (   filename = None  ) 

Initializes the instance of IDNA2008 conversion context.

The context will be initialized according with the configuration file specified by the argument 'filename'. If 'filename' is None, the context will have the default settings upon return. If 'filename' is not None but empty, the context reads the configuration file of the default path.

Parameters:
filename Configuration file to be read.
Exceptions:
idnkit.Error Initialization failed.

def idnkit.IDNA2008.set_local_check_file (   filename = None  ) 

Reads a code point set for local-check from a file 'filename'.

If 'filename' is None, the local code point set the conversion context memories is cleared.

Parameters:
filename Code point set file to be read.
Exceptions:
idnkit.Error Failed to read the file.


The documentation for this class was generated from the following file:
Generated on Wed Dec 8 15:38:23 2010 for idnkit-python by  doxygen 1.4.7