On Tuesday, March 22, 2011 3:28:20 PM UTC-4, LightOfMooN wrote: 
>
> I have table with too much cols. 
> So, is there a way to pass variable names and values in the insert() 
> or update() methods like this? 
>
>
>     options_house = 
> db(db.company_houses_options.company_id==company.id).select().first() 
>     if request.vars.edit_options_house: 
>         houses_options={} 
>         for column_name in houses_columns: 
>             if request.vars.get(column_name, None): 
>                 houses_options[column_name]=True 
>             else: 
>                 houses_options[column_name]=False 
>         options_house.update_record(houses_options) 
>
> where houses_columns is a list of columns names like 
> ['street','house','block','buildyear',...]

 
In Python, I think you can pass a dict preceded by ** to a function and the 
dict will be separated into a set of keyword args. So, you would do:
 
options_house.update_record(**house_options)
 
I think that would work.
 
Anthony

Reply via email to