Package gavo :: Package rscdef :: Module mixins :: Class MixinDef
[frames] | no frames]

Class MixinDef

source code

                           object --+        
                                    |        
            base.activetags.ActiveTag --+    
                                        |    
                   object --+           |    
                            |           |    
 base.structure.StructureBase --+       |    
                                |       |    
                   object --+   |       |    
                            |   |       |    
           base.common.Parser --+       |    
                                |       |    
base.structure.ParseableStructure --+   |    
                                    |   |    
             base.structure.Structure --+    
                                        |    
                       object --+       |    
                                |       |    
         base.macros.MacroPackage --+   |    
                                    |   |    
       base.macros.StandardMacroMixin --+    
                                        |    
               base.activetags.ReplayBase --+
                                            |
                                           MixinDef

A definition for a resource mixin.

Resource mixins are resource descriptor fragments typically rooted in tables (though it's conceivable that other structures could grow mixin attributes as well).

They are used to define and implement certain behaviours components of the DC software want to see:

Mixins consist of events that are played back on the structure mixing in before anything else happens (much like original) and two procedure definitions, viz, processEarly and processLate. These can access the structure that has the mixin as substrate.

processEarly is called as part of the substrate's completeElement method. processLate is executed just before the parser exits. This is the place to fix up anything that uses the table mixed in. Note, however, that you should be as conservative as possible here -- you should think of DC structures as immutable as long as possible.

Programmatically, you can check if a certain table mixes in something by calling its mixesIn method.

Recursive application of mixins, even to seperate objects, will deadlock.

Nested Classes

Inherited from base.structure.StructureBase: __metaclass__

Instance Methods
 
completeElement(self, ctx) source code
 
execMacro(self, macName, args) source code
 
applyTo(self, destination, ctx, fillers={})
replays the stored events on destination and arranges for processEarly and processLate to be run.
source code
 
applyToFinished(self, destination)
applies the mixin to an object already parsed.
source code

Inherited from base.activetags.ReplayBase: replay

Inherited from base.structure.Structure: __provides__, callCompletedCallbacks, finishElement, onElementComplete, validate

Inherited from base.structure.ParseableStructure: __init__, end_, feed, feedFrom, feedObject, getAttribute, iterEvents, start_, value_

Inherited from base.structure.StructureBase: __providedBy__, adopt, breakCircles, change, copy, getAttributes, getCopyableAttributes, getSourcePosition, iterChildren, setPosition

Inherited from base.common.Parser: feedEvent

Inherited from base.macros.StandardMacroMixin: macro_RSTservicelink, macro_RSTtable, macro_decapitalize, macro_getConfig, macro_internallink, macro_magicEmpty, macro_metaSeq, macro_metaString, macro_rdId, macro_rdIdDotted, macro_schema, macro_test, macro_today, macro_upper, macro_urlquote

Inherited from base.macros.MacroPackage: expand, getExpander, listMacros, macro_quote, macro_reSub, macro_sql_standardPubDID, macro_sqlquote

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

Class Methods

Inherited from base.structure.StructureBase: fromStructure

Class Variables
  name_ = 'mixinDef'
hash(x)
  attrSeq = [<gavo.base.attrdef.UnicodeAttribute object>, <gavo....
  managedAttrs = {'EDIT': <gavo.base.complexattrs.StructListAttr...

Inherited from base.structure.Structure: __implemented__

Inherited from base.structure.StructureBase: completedCallbacks

Properties

Inherited from object: __class__

Method Details

completeElement(self, ctx)

source code 
Overrides: base.structure.Structure.completeElement

execMacro(self, macName, args)

source code 
Overrides: base.macros.MacroPackage.execMacro

applyToFinished(self, destination)

source code 

applies the mixin to an object already parsed.

Late callbacks will only be executed if destination has an rd attribute; if that is the case, this rd's idmap will be amended with anything the mixin comes up with.


Class Variable Details

attrSeq

Value:
[<gavo.base.attrdef.UnicodeAttribute object>,
 <gavo.base.complexattrs.StructListAttribute object>,
 <gavo.base.complexattrs.StructAttribute object>,
 <gavo.base.parsecontext.IdAttribute object>,
 <gavo.base.complexattrs.StructAttribute object>,
 <gavo.base.parsecontext.OriginalAttribute object>,
 <gavo.base.complexattrs.UniquedStructListAttribute object>,
 <gavo.base.complexattrs.StructAttribute object>,
...

managedAttrs

Value:
{'EDIT': <gavo.base.complexattrs.StructListAttribute object>,
 'PRUNE': <gavo.base.complexattrs.StructListAttribute object>,
 'doc': <gavo.base.attrdef.UnicodeAttribute object>,
 'edits': <gavo.base.complexattrs.StructListAttribute object>,
 'events': <gavo.base.complexattrs.StructAttribute object>,
 'id': <gavo.base.parsecontext.IdAttribute object>,
 'lateEvents': <gavo.base.complexattrs.StructAttribute object>,
 'mixinPar': <gavo.base.complexattrs.UniquedStructListAttribute object\
...