>
> class WishList():
> def add_to_wish_list(self,db,table,field1,value1,field2,value2): # or is
> better list of **fields,**values ?
> try:
> db.table.insert(field1=value1,field2=value2) #insert or
> validate_and_insert?
>
Seems fine, but you can't do db.table if "table" is a variable -- it would
have to be db[table]. Same problem with field1, field2, etc. -- you would
have to do:
db[table].insert(**{field1: value1, field2: value2})
To make it easier, you can do:
def add_to_wish_list(self, db, table, **record):
try:
db[table].insert(**record)
and then call it this way:
wishlist_obj.add_to_wish_list(db, 'wishlist', field1=value1, field2=value2)
Anthony
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.