[web2py] Re: Lazy virtual fields - strange result!

2011-09-08 Thread Michael Toomim
After some thought, I'm really liking this design for virtual fields... what if lazy/virtual fields were declared directly in db.define_table()? Like so: db.define_table('item', Field('unit_price','double'), Field('quantity','integer'), VirtualField

[web2py] Re: Lazy virtual fields - strange result!

2011-08-27 Thread Michael Toomim
I'm sorry, that was a doofus comment. Of course lambdas allow side- effects! I wish mailing lists supported "delete." On Aug 27, 1:08 pm, Michael Toomim wrote: > Interesting approach to use lambdas.  Since lambdas don't do side- > effects, I checked out my virtualfields to see if my uses have s

[web2py] Re: Lazy virtual fields - strange result!

2011-08-27 Thread Michael Toomim
Interesting approach to use lambdas. Since lambdas don't do side- effects, I checked out my virtualfields to see if my uses have side effects. In my app I have: 12 methods total across 3 database tables 10 of those methods have no side-effects 2 have side-effects The two methods with side-effect

Re: [web2py] Re: Lazy virtual fields - strange result!

2011-08-26 Thread Martin Weissenboeck
I got: Traceback (most recent call last): ... db.item.lazy_total_price=Field.lazy(lambda self:self.item.unit_price*self.item.quantity) AttributeError: type object 'Field' has no attribute 'lazy' Version 1.98.2 (2011-08-25 19:11:31) Martin 2011/8/25 Massimo Di Pierro > The nightly build or tru

[web2py] Re: Lazy virtual fields - strange result!

2011-08-25 Thread Massimo Di Pierro
The nightly build or trunk. On Aug 25, 10:24 am, Martin Weissenboeck wrote: > Thank you. Which version of web2py? 1.98.2 does not know Field.lazy > > 2011/8/25 Massimo Di Pierro > > > > > > > > > We are moving away from this because of many problems. Try this > > instead. It is still experimenta

Re: [web2py] Re: Lazy virtual fields - strange result!

2011-08-25 Thread Martin Weissenboeck
Thank you. Which version of web2py? 1.98.2 does not know Field.lazy 2011/8/25 Massimo Di Pierro > We are moving away from this because of many problems. Try this > instead. It is still experimental but may go into stable soon. > > def vfields(): > db.define_table('item', > Field('unit_pri

[web2py] Re: Lazy virtual fields - strange result!

2011-08-25 Thread Massimo Di Pierro
We are moving away from this because of many problems. Try this instead. It is still experimental but may go into stable soon. def vfields(): db.define_table('item', Field('unit_price','double'), Field('quantity','integer')) db(db.item.id>0).delete() db.item.lazy_total_price=Fi