Hedley Roos wrote:
Replying to my own post for future reference...
I was not successful in using @ComputedAttribute, but I could do
def _foo(self):
# Trivial example
return self.aq_parent.id
foo = ComputedAttribute(_foo, 1)
This looks a lot like the way we used to do decorators before we got
the @ syntactic sugar. Maybe the correct way to use the decorator is
@ComputedAttribute(1). I don't know and I do not have enough time to
investigate.
I think you'd need to make a custom decorator. Something like:
def aq_aware_property(fn):
return ComputedAttribute(fn, 1)
Then you can do:
@aq_aware_property
def foo(self):
return self.aq_parent.id
Martin
--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers