icat.helper — A collection of internal helper routines

Note

This module is intended for the internal use in python-icat and is not considered to be part of the API. No effort will be made to keep anything in here compatible between different versions.

icat.helper.simpleqp_quote(obj)

Simple quote in quoted-printable style.

icat.helper.simpleqp_unquote(qs)

Simple unquote from quoted-printable style.

icat.helper.parse_attr_val(avs)

Parse an attribute value list string.

Parse a string representing a list of attribute and value pairs in the form:

attrvaluestring ::= attrvalue 
                |   attrvalue '_' attrvaluestring
attrvalue       ::= attr '-' value
value           ::= simplevalue 
                |   '(' attrvaluestring ')'
attr            ::= [A-Za-z]+
simplevalue     ::= [0-9A-Za-z=]+

Return a dict with the attributes as keys. In the case of an attrvaluestring in parenthesis, this string is set as value in the dict without any further processing.

icat.helper.parse_attr_string(s, attrtype)

Parse the string representation of an entity attribute.

Note: for Date we use the parser from suds.sax.date. If this is the original Suds version, this parser is buggy and might yield wrong results. But the same buggy parser is also applied by Suds internally for the Date values coming from the ICAT server. Since we are mainly interested to compare with values from the ICAT server, we have a fair chance that this comparision nevertheless yields valid results.

icat.helper.ms_timestamp(dt)

Convert datetime.datetime or string to timestamp in milliseconds since epoch.

Previous topic

icat.exception — Exception handling

Next topic

icat.icatcheck — Check compatibility with the ICAT server