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

Class Extension
source code

object --+
         |
        Extension
Known Subclasses:
host.Host, test.expectation_database.ExpectationDatabase, test.runnable.Runnable, test.result_reader.ResultReader, test.target.Target, test.run_database.RunDatabase, test.suite.Suite, test.result_stream.ResultStream, test.database.Database, test.classes.sql_result_stream._SQLConnected

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]
  GetClassName(self)
Return the name of the extension class.
  GetExplicitArguments(self)
Return the arguments to this extension instance.
  MakeDomDocument(self)
Create a DOM document for 'self'.
  MakeDomElement(self, document, element=None)
Create a DOM node for 'self'.
  Write(self, file)
Write an XML description of 'self' to a file.
  __getattr__(self, name)
  __init__(self, **args)
Construct a new 'Extension'.

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


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

Inherited from object: __class__


Method Details [hide private]

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.

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.

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

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.

__getattr__(self, name)
(Qualification operator)

source code 

__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__

Class Variable Details [hide private]

_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:
{}                                                                     
      

_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:
{}                                                                     
      

_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:
{}                                                                     
      

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:
{}