Should be .update(api_key=uuid.uuid4()).

Anthony

On Wednesday, January 29, 2014 5:09:40 PM UTC-5, 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to