virtualfields.append not add, right?  Sounds good to me.  Shall I take
a crack at it or do you already have it in trunk :)

On Oct 31, 3:31 pm, mdipierro <[email protected]> wrote:
> or just
>
> db.table.virtualfields.add(ComputedFields())
>
> as a lazy
>
> rows.setvirtualfields(table=ComputedFields())
>
> it can be implemented in two lines if ok.
>
> Massimo
>
> On Oct 31, 3:04 pm, mdipierro <[email protected]> wrote:
>
> > I like it but with some caveats. In
>
> >    rows.setvirtualfields(total=ComputedFields())
>
> > we need to specify total to clarify the table or virtualtable the
> > virtualfields are attached to.
> > when attaching virtualfields to a table there is no need to specify
> > that.
>
> > So I think it should just be:
>
> >    table.addvirtualfields(ComputeFields())
>
> > Implementation:
>
> > The argument would be appended to
>
> >    table._virtualfields=[]
>
> > and the latter would be precessed by
>
> >    Set.parse
>
> > that for each element table._virtualfields would call
>
> >    setvirtualfields
>
> > On Oct 31, 1:16 pm, "mr.freeze" <[email protected]> wrote:
>
> > > Virtual fields are my new favorite thing. Currently you must call
> > > setvirtualfields after each select.  What about adding the ability to
> > > setvirtualfields at the Table level so that any select will call
> > > setvirtualfields automatically? Pseudocode:
>
> > > db.define_table('mytable',Field('cost'),Field('quantity'))
> > > class ComputedFields:
> > >     def amount(self):
> > >         return self.mytable.cost*self.mytable.quantity
> > > db.mytable.setvirtualfields(total=ComputedFields())
>
> > > What do you think?
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to