Package gavo :: Package base :: Module parsecontext :: Class OriginalAttribute
[frames] | no frames]

Class OriginalAttribute

source code

          object --+        
                   |        
attrdef.AttributeDef --+    
                       |    
 attrdef.AtomicAttribute --+
                           |
                          OriginalAttribute

is an attribute that resolves an item copies over the managed attributes from the referenced item.

The references may be anything resolveId can cope with.

You can pass a forceType argument to make sure only references to specific types are allowable. In general, this will be the class itself of a base class. If you don't do this, you'll probably get weird AttributeErrors for certain inputs.

To work reliably, these attributes have to be known to the XML parser so it makes sure they are processed first. This currently works by name, and "original" is reserved for this purpose. Other names will raise an AssertionError right now.

As a safety mechanism, OriginalAttribute checks if it is replacing a "pristine" object, i.e. one that has not had events fed to it.

Instance Methods
 
__init__(self, name='original', description='An id of an element to base the current one on. This provide..., forceType=None, **kwargs)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
feedObject(self, instance, original, ctx=None) source code
 
feed(self, ctx, instance, literal) source code

Inherited from attrdef.AtomicAttribute: getCopy, makeUserDoc, parse, unparse

Inherited from attrdef.AttributeDef: doCallbacks, iterParentMethods

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

Class Variables
  computed_ = True
  typeDesc_ = 'id reference'
Properties

Inherited from object: __class__

Method Details

__init__(self, name='original', description='An id of an element to base the current one on. This provide..., forceType=None, **kwargs)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

feedObject(self, instance, original, ctx=None)

source code 
Overrides: attrdef.AttributeDef.feedObject

feed(self, ctx, instance, literal)

source code 
Overrides: attrdef.AttributeDef.feed