ZPatterns feature patch: kickTriggers
I've patched DataSkins.py to add this method: def kickTriggers(self,_v_status_=_v_status_,_v_dm_=_v_dm_): """Cause triggers to be set off at the end of this transaction, without needing to set any attributes.""" self = self._canonicalForm() if self._v_status_ is not ChangedStatus: d=self.__dict__ d[_v_dm_]._objectChanging(self) d[_v_status_] = ChangedStatus I often want triggers to fire on a DataSkin because some other specialist knows about a change that will affect that Dataskin's computed attributes. I don't need to change the DataSkin; I just want the triggers to fire at the end of the transaction. My current hack for causing triggers to fire without needing to actually change an attribute has recently stopped working. object.propertysheets.Basic. manage_changeProperties(bogus_property_to_prime_triggers=1) This is due to recent optimisations in OFS/PropertySheets.py in Zope 2.3 from CVS -- now, an object only gets changed when you alter a property that actually exists. This is a good thing, as it reduces bloat in the ZODB. I'd welcome suggestions on a better name for the method than "kickTriggers". :-) -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net
Hmmm... tripTriggers(...) pullTriggers(...) fireTriggers(...) ;-) dunno... kickTriggers works for me... -steve
"SA" == Steve Alexander <steve@cat-box.net> writes:
SA> I've patched DataSkins.py to add this method: ... SA> I'd welcome suggestions on a better name for the method than SA> "kickTriggers". :-) SA> -- Steve Alexander Software Engineer Cat-Box limited SA> http://www.cat-box.net SA> _______________________________________________ Zope-Dev SA> maillist - Zope-Dev@zope.org SA> http://lists.zope.org/mailman/listinfo/zope-dev ** No cross SA> posts or HTML encoding! ** (Related lists - SA> http://lists.zope.org/mailman/listinfo/zope-announce SA> http://lists.zope.org/mailman/listinfo/zope )
Steve Spicklemire wrote:
Hmmm...
tripTriggers(...)
I like this one.
pullTriggers(...) fireTriggers(...)
I'm not so sure about these two. I think the name should not imply that calling the method will cause triggers to be fired immediately, as the triggers are fired only at a transaction boundary.
dunno... kickTriggers works for me...
Thanks. -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net
Steve Alexander wrote:
I'd welcome suggestions on a better name for the method than "kickTriggers". :-)
Well, in keeping with the nomenclature of RuleAgents and IndexingAgents, how about DoubleAgent (it secretly works for another Specialist)? Michael Bernstein
participants (4)
-
Michael R. Bernstein -
R. David Murray -
Steve Alexander -
Steve Spicklemire