[PEAK] Trellis on_commit and Performers
Sergey Schetinin
maluke at gmail.com
Fri Oct 3 02:27:39 EDT 2008
Performers don't seem to notice changes that are made in on_commit
callbacks. In this sample the use of on_commit doesn't make sense, but
generally it can be useful. Anyway if this is by design, it would be
great if cases like this were detected and raised an exception.
from peak.events.trellis import *
class Watch(Component):
list = attr()
@perform
def watch_count(self):
print len(self.list)
l = List()
lw = Watch(list=l)
atomically(on_commit, l.append, 1)
This prints just []
I also wonder if I'm trying to make Trellis do something it can't.
What I'm trying to do is to collect all the data required for certain
operation with side-effects and perform it in on_commit. That
operation also changes some Trellis cells which then should trigger a
set of performers that would modify the newly created
(non-trellis-managed) object.
To work around this, I changed the code to schedule the call by other
means than on_commit, so the second round of changes happens in a new
transaction, but I wonder what's the intended way to accomplish this?
--
Best Regards,
Sergey Schetinin
http://s3bk.com/ -- S3 Backup
http://word-to-html.com/ -- Word to HTML Converter
More information about the PEAK
mailing list