Thank you Phillip, <br>now it is all clearer.<br><br><br><div class="gmail_quote">On Thu, Apr 17, 2008 at 6:27 PM, Phillip J. Eby <<a href="mailto:pje@telecommunity.com">pje@telecommunity.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">At 09:23 AM 4/17/2008 +0300, Peter Damoc wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
@trellis.observer<br>
def updateView(self):<br>
x = len(self.records) # needed to monitor changes<br>
self.filtered_records = [x for x in self.records]<br>
</blockquote>
<br></div>
You can't modify trellis data in an observer. Move this line to a rule of its own, and change it to:<br>
<br>
@trellis.rule<br>
def do_filtering(self):<br>
self.filtered_records.clear()<br>
self.filtered_records.update(x for x in self.records if x...)<br>
<br>
This way, the same set object will be updated in-place. Your observer should now check 'self.sorted_records.changes' instead of 'len(self.records)' to ensure it's triggered when a change occurs.<br>
<br>
Meanwhile, the reason that you're getting a conflict is because you are assigning different values to the filtered_records attribute in two places during the same calculation.<br>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>There is NO FATE, we are the creators.