|
Functions
|
|
|
|
|
|
get_class_arguments
|
get_class_arguments ( extension_class )
Return the arguments associated with extension_class.
-
extension_class
- A class derived from
Extension.
- returns
- A list of
Field objects containing all of the
arguments in the class hierarchy.
|
Exceptions
|
|
qm.common.QMException, qm.error( "ext arg name matches class var", class_name = extension_class.__name__, argument_name = name )
|
|
|
|
get_class_arguments_as_dictionary
|
get_class_arguments_as_dictionary ( extension_class )
Return the arguments associated with extension_class.
-
extension_class
- A class derived from
Extension.
- returns
- A dictionary mapping argument names to
Field
objects. The dictionary contains all of the arguments in the
class hierarchy.
|
|
|
get_class_description
|
get_class_description ( extension_class, brief=0 )
Return a brief description of the extension class extension_class.
-
extension_class
- A class derived from
Extension.
-
brief
- If true, return a brief (one-line) description of the
extension class.
- returns
- A structured text description of
extension_class.
|
|
|
get_extension_class_name
|
get_extension_class_name ( extension_class )
Return the name of extension_class.
-
extension_class
- A class derived from
Extension.
- returns
- The name of
extension_class. This is the name that
is used when users refer to the class.
|
|
|
make_dom_document
|
make_dom_document ( extension_class, arguments )
Create a DOM document for an instance of extension_class.
-
extension_class
- A class derived from
Extension.
-
arguments
- The arguments to the extension class.
- returns
- A new DOM document corresponding to an instance of the
extension class.
|
|
|
make_dom_element
|
make_dom_element (
extension_class,
arguments,
document,
element=None,
)
Create a DOM node for an instance of extension_class.
-
extension_class
- A class derived from
Extension.
-
arguments
- The arguments to the extension class.
-
document
- The DOM document that will contain the new
element.
-
element
- If not
None the extension element to which items
will be added. Otherwise, a new element will be created by this
function.
- returns
- A new DOM element corresponding to an instance of the
extension class. The caller is responsible for attaching it to
the
document.
|
|
|
parse_descriptor
|
parse_descriptor ( descriptor, class_loader )
Parse a descriptor representing an instance of Extension.
-
descriptor
- A string representing an instance of
Extension.
The descriptor has the form class(arg1 = "val1", arg2 = "val2",
...). The arguments and the parentheses are optional.
If class names a file in the file system, it is assumed to be an
extension file. Any attributes provided in the descriptor
override those in the file.
-
class_loader
- A callable. The callable will be passed the
name of the extension class and must return the actual class
object.
- returns
- A pair (
extension_class, arguments) containing the
extension class (a class derived from Extension) and the
arguments (a dictionary mapping names to values) stored in the
element. The arguments will have already been processed by
validate_arguments by the time they are returned.
|
Exceptions
|
|
qm.QMException, qm.error("invalid descriptor syntax", start = arguments_string [ tok [ 2 ] [ 1 ] : ] )
|
|
|
|
parse_dom_element
|
parse_dom_element (
element,
class_loader,
attachment_store=None,
)
Parse a DOM node representing an instance of Extension.
-
element
- A DOM node, of the format created by
make_dom_element.
-
class_loader
- A callable. The callable will be passed the
name of the extension class and must return the actual class
object.
-
attachment_store
- The
AttachmentStore in which attachments
can be found.
- returns
- A pair (
extension_class, arguments) containing the
extension class (a class derived from Extension) and the
arguments (a dictionary mapping names to values) stored in the
element.
|
|
|
read_extension_file
|
read_extension_file (
file,
class_loader,
attachment_store=None,
)
Parse a file describing an extension instance.
-
file
- A file-like object from which the extension instance
will be read.
-
class_loader
- A callable. The callable will be passed the
name of the extension class and must return the actual class
object.
-
attachment_store
- The
AttachmentStore in which attachments
can be found.
- returns
- A pair (
extension_class, arguments) containing the
extension class (a class derived from Extension) and the
arguments (a dictionary mapping names to values) stored in the
element.
|
|
|
validate_arguments
|
validate_arguments ( extension_class, arguments )
Validate the arguments to the extension_class.
-
extension_class
- A class derived from
Extension.
-
arguments
- A dictionary mapping argument names (strings) to
values (strings).
- returns
- A dictionary mapping 'Field's to values.
Check that each of the arguments is a valid argument to
extension_class. If so, the argumets are converted as required
by the Field, and the dictionary returned contains the converted
values. Otherwise, an exception is raised.
|
Exceptions
|
|
qm.QMException, qm.error("unexpected extension argument", name = name, class_name = get_extension_class_name( extension_class ) )
qm.QMException, qm.error("value provided for computed field", name = name, class_name = get_extension_class_name( extension_class ) )
|
|
|
|
write_extension_file
|
write_extension_file (
extension_class,
arguments,
file,
)
Write an XML description of an extension to file.
-
extension_class
- A class derived from
Extension.
-
arguments
- A dictionary mapping argument names to values.
-
file
- A file object to which the data should be written.
|
|
Classes
|
|
Extension |
A class derived from Extension is a QM extension.
|
|