While debugging some dependencies in some of my SkinScript, I had an idea.

SkinScript could be extended so that COMPUTE statements can have a 
RECOMPUTE FOR clause. This clause would tell a dataskin to invalidate 
its cache for the attributes in the COMPUTE statement if any of the 
attributes in the RECOMPUTE FOR clause changed.

So,

WITH QUERY some_method(primary_key=ms_vars_id) COMPUTE
   foo,bar,baz
OTHERWISE LET
   foo='no foo',
   bar='no bar',
   baz='no baz'
RECOMPUTE FOR
   ms_vars_id

This is equivalent to the above statement, without the RECOMPUTE FOR 
clause, followed by a trigger:

WHEN OBJECT ADDED, CHANGED CALL
   HAS_CHANGED('ms_vars_id')
     and self._uncache_attrs(['foo', 'bar', 'baz'])

This assumes a method of DataSkins.DataSkin _uncache_attrs:

def _uncache_attrs(self, names):
     v=self._v_attrCache
     for name in names:
       del v[name]


I haven't tested any of this yet.

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net


_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to