icat.icatcheck — Check compatibility with the ICAT server

Note

This module provides tests to check the compatibility of the client with the WSDL description got from the ICAT server. It is mainly useful for the package maintainer.

Deprecated since version 0.17: This module is deprecated and will be removed in version 1.0.

class icat.icatcheck.ICATChecker(client)

Bases: object

Provide checks for the ICAT schema from a given server.

Check that the entities defined in the ICAT client are in sync with the WSDL schema got from the ICAT server.

gettypes()

Return a list of the types defined in the WSDL.

getentities()

Search for entities defined at the server.

Return a dict with type names as keys and EntityInfo objects as values.

check()

Check consistency of the ICAT client with the server schema.

Report any abnormalities as warnings to the logger. Returns the number of warnings emitted.

checkExceptions()

Check consistency of exceptions.

Check that all icatExceptionTypes defined in the WSDL have a corresponding exception class defined in icat.exception. Report missing exceptions as a warning to the logger. Return the number of warnings emitted.

pythonsrc(genealogyrules=None, baseclassname='Entity')

Generate Python source code matching the ICAT schema.

Generate source code for a set of classes that match the entity info found at the server. The source code is returned as a string.

The Python classes are created as a hierarchy. It is assumed that there is one abstract base type which is the root of the genealogy tree. In the case of the ICAT 4.2.* schema, this assumptions holds, the base is suds.sudsobject.entityBaseBean.

Entity classes having children in the hierarchy are assumed to be abstract. In this case the attribut icat.entity.Entity.BeanName is set to None.

Parameters:
  • genealogyrules (list of tuple) – define the rules for the genealogy tree. It must be a list of tuples, each having two elements, a regular expression and the name of a parent type. Each type matching the regular expression is assumed to be derived from the parent. The first match in the list wins. The last element in the list should be a default rule of the form (r'','base'), where base is the name of the root.
  • baseclassname (str) – the name for the base class at the root of the genealogy tree that shall be used in the Python output.
Returns:

Python source.

Return type:

str

Raises:

GenealogyError – if the genealogy tree defined by genealogyrules is not consistent.