Package gchecky :: Module gxml :: Class NodeManager
[hide private]
[frames] | no frames]

Type NodeManager

source code

object --+    
         |    
      type --+
             |
            NodeManager
Known Subclasses:
DocumentManager

The class keeps track of all the subclasses of Node class.

It retrieves a Node fields and provides this information to the class.

This class represents a hook on-Node-subclass-creation where 'creation' means the moment the class is first loaded. It allows dynamically do some stuff on class load. It could also be done statically but that way we avoid code and effort duplication, which is quite nice. :-)

Instance Methods [hide private]

Inherited from type: __call__, __cmp__, __delattr__, __getattribute__, __hash__, __repr__, __setattr__, __subclasses__, mro

Inherited from object: __init__, __reduce__, __reduce_ex__, __str__

Static Methods [hide private]
 
__new__(cls, name, bases, attrs)
Dynamically do some stuff on a Node subclass 'creation'.
source code
Class Variables [hide private]
  nodes = {'Document': <class 'gchecky.gxml.Document'>, 'Node': ...
The dictionary class_name → class keeps all the Node subclasses.
Properties [hide private]

Inherited from type: __base__, __bases__, __basicsize__, __dictoffset__, __flags__, __itemsize__, __mro__, __name__, __weakrefoffset__

Inherited from object: __class__

Method Details [hide private]

__new__(cls, name, bases, attrs)
Static Method

source code 

Dynamically do some stuff on a Node subclass 'creation'.

Specifically do the following:
  • create the class (via the standard type.__new__)
  • retrieve all the fields of the class (its own and inherited)
  • store the class reference in the nodes dictionary
  • give the class itself the access to its field list
Returns:
a new object with type S, a subtype of T

Overrides: type.__new__

Class Variable Details [hide private]

nodes

The dictionary class_name → class keeps all the Node subclasses.
Value:
{'Document': <class 'gchecky.gxml.Document'>,
 'Node': <class 'gchecky.gxml.Node'>,
 'abstract_notification_t': <class 'gchecky.model.abstract_notificatio\
n_t'>,
 'abstract_order_t': <class 'gchecky.model.abstract_order_t'>,
 'add_merchant_order_number_t': <class 'gchecky.model.add_merchant_ord\
er_number_t'>,
 'add_tracking_data_t': <class 'gchecky.model.add_tracking_data_t'>,
...