On 8/17/11 7:54 AM, Jacek Kałucki wrote:
> Użytkownik Paul McNett napisał:
>> I hardly use it either. Jacek could you show me a patch? I never thought
>> there was a
>> use case where the difference would matter.
>
> I don't want to change anything in existing code except adding helper
> function:
> http://dabo.codepad.org/qba1Qakh
>
> Now, it doesn't matter from where it's called, from dBizobj or dCursorMixin,
> rows are always advanced.
Ah, so Dabo defines the VirtualField decorator, but user code actually does the
decorating. I wouldn't name it @VirtualField, though. I'd name it something
like
@vfUpdateChildren.
Decorators are cool, but it's taken me awhile to warm up to actually using them.
But now, you have me thinking of alternate ways to define VirtualFields in the
first
place. Currently, you do something like:
{{{
class MyBiz(dabo.biz.dBizobj):
def initProperties(self):
self.VirtualFields["display_amount"] = self.getDisplayAmount
def getDisplayAmount(self):
return local.format("$%s" % self.Record.amount)
}}}
But what about this instead:
{{{
class MyBiz(dabo.biz.dBizobj):
@VirtualField("display_amount")
def getDisplayAmount(self):
return local.format("$%s" % self.Record.amount)
}}}
Paul
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[email protected]