Package gavo :: Package base :: Module complexattrs :: Class DictAttribute
[frames] | no frames]

Class DictAttribute

source code

          object --+    
                   |    
attrdef.AttributeDef --+
                       |
                      DictAttribute
Known Subclasses:

an attribute containing a mapping.

DictAttributes are fairly complex beasts supporting a number of input forms.

The input to those looks like <d key="foo">abc</d>; they are constructed with an itemAttD (like StructAttributes), but the name on those is ignored; they are just used for parsing from the strings in the element bodies, which means that itemAttDs must be derived from AtomicAttribute.

You can give a different keyNames; the key attribute is always accepted, though.

For sufficiently exotic situations, you can construct DictAttributes with inverted=True; the resulting dictionary will then have the keys as values and vice versa (this is a doubtful feature; let us know when you use it).

You can also add to existing values using the cumulate XML attribute; <d key="s">a</d><d key="s" cumulate="True">bc</a> will leave abc in s.

Instance Methods
 
__init__(self, name, description='Undocumented', itemAttD=<gavo.base.attrdef.UnicodeAttribute object>, keyName='key', inverted=False, **kwargs)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
feedObject(self, instance, value) source code
 
create(self, parent, ctx, name) source code
 
iterEvents(self, instance) source code
 
getCopy(self, instance, newParent, ctx) source code
 
makeUserDoc(self) source code

Inherited from attrdef.AttributeDef: doCallbacks, feed, iterParentMethods

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

Properties
  typeDesc_
  default_

Inherited from object: __class__

Method Details

__init__(self, name, description='Undocumented', itemAttD=<gavo.base.attrdef.UnicodeAttribute object>, keyName='key', inverted=False, **kwargs)
(Constructor)

source code 

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

Overrides: object.__init__
(inherited documentation)

feedObject(self, instance, value)

source code 
Overrides: attrdef.AttributeDef.feedObject

getCopy(self, instance, newParent, ctx)

source code 
Overrides: attrdef.AttributeDef.getCopy

makeUserDoc(self)

source code 
Overrides: attrdef.AttributeDef.makeUserDoc

Property Details

typeDesc_

Get Method:
unreachable.typeDesc_(self)

default_

Get Method:
unreachable.default_(self)