Table of Contents

Module: eXistDA_utils trunk/eXistDA_utils.py

eXistDA_utils.py : Utilities for eXistDA Product

Functions   
URIHasServerName
convert
getDict
getInvalidMsg
getRscNameFromURI
getServerNameFromURI
hasExpat
hasXSLTProc
is4SuiteAvailable
isFileURI
isHTTPURI
iseXistURI
mergeDict
recurse_getDict
  URIHasServerName 
URIHasServerName ( URI )

Returns True if the URI is containing a server name, False otherwise.

  • URI : a string containing the URI to scan.

  convert 
convert (
        text,
        encoding_from,
        encoding_to,
        )

Converts text , encoded in encoding_from to the encoding encoding_to.

  • returns the text converted into encoding_to (if necessary) or raise an exception if something weird happened

  • text : a string containing the text to convert

  • encoding_from : a string containing the encoding of the text to convert

  • encoding_to : a string containing the encoding to convert the text to

  getDict 
getDict ( fichier_string,  encoding=DEFAULT_ENCODING )

Returns the dict by calling the recursive method recurse_getDict.

  getInvalidMsg 
getInvalidMsg (
        server='',
        port='',
        username='',
        password='',
        encoding='',
        )

Verifies if the parameters passed to create or modify an eXistDA object are valid for use. Not all is verified...

  • Returns None if no error is found. Returns a MessageDialog object if something bad happened.

Exceptions   
ValueError
  getRscNameFromURI 
getRscNameFromURI ( URI )

Get the resource name from an URI.

  • Returns the name of the [eXist | HTTP] resource corresponding to the URI. Returns empty string if none.

  getServerNameFromURI 
getServerNameFromURI ( URI )

Get the server name from an URI.

  • Returns a string containing the name of the [eXist | HTTP] server corresponding to the URI (with the port number). Returns empty string if none.

  hasExpat 
hasExpat ()

Returns True if Expat module is available

  hasXSLTProc 
hasXSLTProc ()

Returns True is xsltproc is installed and in the path

  is4SuiteAvailable 
is4SuiteAvailable ()

Returns 1 if 4Suite can be used to make external XSLT, 0 otherwise.

  isFileURI 
isFileURI ( URI )

Verifies if URI is a file URI (ie beggining with HEADER_FILE_URI).

  • returns 1 if URI is a file-like URI. 0 otherwise

  • URI : the string to test

  isHTTPURI 
isHTTPURI ( URI )

Verifies if URI is an HTTP URI (ie beggining with HEADER_HTTP_URI).

  • Returns 1 if URI is an HTTP-like URI. 0 otherwise

  • URI : the string to test

  iseXistURI 
iseXistURI ( URI )

Verifies if URI is an eXist URI (ie beggining with HEADER_EXIST_URI).

  • Returns 1 if URI is an eXist-like URI. 0 otherwise

  • URI : the string to test

  mergeDict 
mergeDict ( dict1,  dict2 )

Returns a new dictionary by merging dict1 and dict2.

WARNING : the two dicts must have the same structure ! If 'dict1["my_key"] and dict2["my_key"] exist and don't have the same type of value, an error will be raised.

  recurse_getDict 
recurse_getDict (
        noeud,
        encoding,
        lst_nom_noeuds,
        cedico,
        )

Returns a part of a dict which keys are XML tags and their values.

Classes   

XMLToDict

Class implementing expat parser to map an XML string to a python dictionary


Table of Contents

This document was automatically generated on Wed Apr 4 20:49:08 2007 by HappyDoc version 2.1