[PEAK] Re: trellis.Set.discard
Sergey Schetinin
maluke at gmail.com
Tue Oct 21 13:58:00 EDT 2008
Hahaha... I found out that my problems with reproducing some of the
issues are because I forgot that I fixed them with this (there goes
explicitness of side-txn =)):
from peak.rules import around
@around(CellAttribute.make_cell.im_func)
def make_cell(next_method, self, typ, ob, name):
if ctrl.readonly:
return side_txn(next_method, self, typ, ob, name)
else:
return next_method(self, typ, ob, name)
Here's another test:
class C1(Component):
x = attr()
@maintain
def rule(self):
self.x = 1
class C2(Component):
c1 = make(C1)
@compute
def calc(self):
return self.c1.x
c = C2()
c.calc
@make is triggered inside compute, so C1.rule ends up running with
ctrl.readonly.
More information about the PEAK
mailing list