qm :: extension :: Extension :: Class Extension
[hide private]
[frames] | no frames]

Class Extension

source code

object --+
         |
        Extension
Known Subclasses:

A class derived from 'Extension' is a QM extension.

A variety of different classes are derived from 'Extension'. All of these classes can be derived from by users to produce customized QM extensions.

'Extension' is an abstract class.

Nested Classes [hide private]
  Type
  __metaclass__
Instance Methods [hide private]
 
__init__(self, **args)
Construct a new 'Extension'.
source code
 
__getattr__(self, name) source code
 
GetClassName(self)
Return the name of the extension class.
source code
 
GetExplicitArguments(self)
Return the arguments to this extension instance.
source code
 
MakeDomElement(self, document, element=None)
Create a DOM node for 'self'.
source code
 
MakeDomDocument(self)
Create a DOM document for 'self'.
source code
 
Write(self, file)
Write an XML description of 'self' to a file.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  arguments = []
A list of the arguments to the extension class.
  kind = None
A string giving kind of extension is implemented by the class.
  _argument_list = []
A list of all the 'Field's in this class.
  _argument_dictionary = {}
A map from argument names to 'Field' instances.
  _allow_arg_names_matching_class_vars = None
True if it is OK for fields to have the same name as class variables.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, **args)
(Constructor)

source code 

Construct a new 'Extension'.

'args': Keyword arguments providing values for Extension parameters. The values should be appropriate for the corresponding fields. Derived classes must pass along any unrecognized keyword arguments to this method so that additional arguments can be added in the future without necessitating changes to derived classes.

This method will place all of the arguments into this objects instance dictionary.

Derived classes may override this method, but should call this method during their processing.

Overrides: object.__init__

GetClassName(self)

source code 

Return the name of the extension class.

returns -- A string giving the name of this etension class.

GetExplicitArguments(self)

source code 

Return the arguments to this extension instance.

returns -- A dictionary mapping argument names to their values. Computed arguments are ommitted from the dictionary.

MakeDomElement(self, document, element=None)

source code 

Create a DOM node for 'self'.

'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'.

MakeDomDocument(self)

source code 

Create a DOM document for 'self'.

'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.

Write(self, file)

source code 

Write an XML description of 'self' to a file.

'file' -- A file object to which the data should be written.


Class Variable Details [hide private]

arguments

A list of the arguments to the extension class.

Each element of this list should be an instance of 'Field'. The 'Field' instance describes the argument.

Derived classes may redefine this class variable. However, derived classes should not explicitly include the arguments from base classes; QMTest will automatically combine all the arguments found throughout the class hierarchy.

Value:
[]

kind

A string giving kind of extension is implemented by the class.

This field is used in an application-specific way; for example, QMTest has 'test' and 'target' extension classes.

Value:
None

_argument_list

A list of all the 'Field's in this class.

This list combines the complete list of 'arguments'. 'Field's appear in the order reached by a pre-order breadth-first traversal of the hierarchy, starting from the most derived class.

Value:
[]

_argument_dictionary

A map from argument names to 'Field' instances.

A map from the names of arguments for this class to the corresponding 'Field'.

Value:
{}

_allow_arg_names_matching_class_vars

True if it is OK for fields to have the same name as class variables.

If this variable is set to true, it is OK for the 'arguments' to contain a field whose name is the same as a class variable. That makes the 'default_value' handling for fields fail, and is generally confusing.

This module no longer allows such classes, unless this variable is set to true. That permits legacy extension classes to continue working, while preventing new extension classes from making the same mistake.

Value:
None