| Home | Trees | Index | Help |
|
|---|
|
|
object --+
|
Cell --+
|
InputCell --+
|
UserDict.DictMixin --+
|
DictCell
>>> class A(cells.Model): ... x = cells.makecell(value={}) ... @cells.fun2cell() ... def xkeys(self, prev): ... return self.x.keys() ... >>> a = A() >>> a.x {} >>> a.xkeys [] >>> a.x['foo'] = 'bar' >>> a.x {'foo': 'bar'} >>> a.xkeys []But if we use a DictCell, this will act like we'd like it to:
>>> class A(cells.Model): ... x = cells.makecell(value={}, type=DictCell) ... @cells.fun2cell() ... def xkeys(self, prev): ... return self.x.keys() ... >>> a = A() >>> a.x {} >>> a.xkeys [] >>> a.x['foo'] = 'bar' >>> a.x {'foo': 'bar'} >>> a.xkeys ['foo']Note that
unchanged_if now operates on dictionary values,
rather than the dictionary itself.
|
|||
|
__init__(self,
owner,
name=None,
rule=None,
value=None,
unchanged_if=None)
Initializes an DictCell object. |
|||
| setdefault(self, key, value) | |||
|
__setitem__(self,
key,
value)
Sets this cell's value's key's value and begins propogation of the change to the dict, if neccessary. |
|||
| __delitem__(self, key) | |||
|
__repr__(self)
repr(x) |
|||
| get(self, key, default=None) | |||
|
__getitem__(self,
key)
Gets the value in self.value[key] |
|||
|
keys(self)
Gets self.value.keys() |
|||
| __contains__(self, key) | |||
| __iter__(self) | |||
| iteritems(self) | |||
|
Inherited from Inherited from Inherited from |
|||
|
|||
|
Inherited from |
|||
|
|||
|
Inherited from |
|||
|
|||
rule.
|
|
|
|
|
|
|
|
|
|
|
| Home | Trees | Index | Help |
|
|---|
| Generated by Epydoc 3.0alpha2 on Sun Aug 20 15:38:09 2006 | http://epydoc.sf.net |