I just found a better way, you can point to the defined function for
compute.

################################
rows = db(db.table).select()

for row in rows:
    row.update_record( mycomputedfield =
db.mytable.mycomputefield.compute(row) )

###############################

I made a test now

#########################################################

db.define_table('products',
                        Field('quantity',integer'),
                        Field('price','double'),
                        Field('total','double',compute =
r:r.quantity*r.price),
                       )

rows = db(db.products).select()

for *row* in rows:
    row.update_record(*total=db.products.total.compute(row)*)

#######################################################

Running web2py from shell you prevent webserver timeout if you are running
multiple records

$python web2py.py -S yourappname -M -P


----
Bruno Rocha
http://about.me/rochacbruno/bio


2011/2/7 Johann Spies <[email protected]>

> Thanks!
>
>
> Regards
> Johann
>
>
> --
>  May grace and peace be yours in abundance through the full knowledge of
> God and of Jesus our Lord!  His divine power has given us everything we need
> for life and godliness through the full knowledge of the one who called us
> by his own glory and excellence.
>                                                     2 Pet. 1:2b,3a
>
>

Reply via email to