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

Class ReferenceAttribute

source code

          object --+        
                   |        
attrdef.AttributeDef --+    
                       |    
 attrdef.AtomicAttribute --+
                           |
                          ReferenceAttribute
Known Subclasses:

An attribute keeping a reference to some other structure

This is a bit messy since the value referred to keeps its original parent, so self.attr.parent!=self for these attributes. This is ok for many applications, but it will certainly not work for, e.g. tables (roughly, it's always trouble when an attribute value's implementation refers to self.parent; this is particularly true for structures having an RDAttribute).

So, before adding a reference attribute, think first whether it wouldn't be wiser to have the real thing and use original to copy things over.

Instance Methods
 
__init__(self, name='ref', default=<Undefined>, description='Uncodumented', forceType=None, **kwargs)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
create(self, structure, ctx, name) source code
 
feed(self, ctx, instance, literal) source code
 
unparse(self, value)
returns a typed python value for the string representation value.
source code

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

Inherited from attrdef.AttributeDef: doCallbacks, iterParentMethods

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

Class Variables
  typeDesc_ = 'id reference'
Properties

Inherited from object: __class__

Method Details

__init__(self, name='ref', default=<Undefined>, description='Uncodumented', forceType=None, **kwargs)
(Constructor)

source code 

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

Overrides: object.__init__
(inherited documentation)

feed(self, ctx, instance, literal)

source code 
Overrides: attrdef.AttributeDef.feed

unparse(self, value)

source code 

returns a typed python value for the string representation value.

value can be expected to be a unicode string.

Overrides: attrdef.AtomicAttribute.unparse
(inherited documentation)