db(db.auth_user.id == auth.user.id).update(api_key == uuid.uuid4())
TypeError: update() takes exactly 1 argument (2 given)


On Thursday, January 30, 2014 12:30:04 AM UTC+2, Avi A wrote:
>
> Thanks,
> I'm still getting the same error.
>
> On Thursday, January 30, 2014 12:18:35 AM UTC+2, Niphlod wrote:
>>
>> the syntax is wrong....
>> it's 
>>
>> db(condition).update(column_name=value)
>>
>> not
>>
>> db(condition).update(db.table.column_name=value)
>>
>> On Wednesday, January 29, 2014 11:09:40 PM UTC+1, Avi A wrote:
>>>
>>> Hi,
>>> I am trying something like that: (render current api key and update it 
>>> if clicking)
>>>
>>> on the view:
>>>
>>> <button  type="button" id="change_api_key">Get new api key</button>
>>> <div id= "target">{{=LOAD('default','api_key.load',ajax=True)}}</div>
>>>
>>>         <script type="text/javascript">
>>> $(document).ready(function(){
>>>   $("#change_api_key").click(function(){
>>>     url = 'api_key.load/1' ;
>>>     ajax(default/url, '', 'target')
>>>       });
>>>   });
>>>
>>> </script>
>>>
>>>
>>> and the controller:
>>>
>>> import uuid
>>> def api_key():
>>>     if request.args(0):
>>>         db(db.auth_user.id == auth.user.id).update(db.auth_user.api_key 
>>> == uuid.uuid4())  #error line
>>>
>>>     my_api_key = db(db.auth_user.id == auth.user.id
>>> ).select(db.auth_user.api_key)
>>>     return locals()
>>>
>>> the error i am getting:
>>>
>>> TypeError: update() takes exactly 1 argument (2 given)
>>>
>>> Thanks.
>>>
>>>
>>>
>>>
>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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.

Reply via email to