On Tuesday, October 20, 2015 at 10:51:28 AM UTC-7, Gael Princivalle wrote:
>
> Thanks Anthony but what does it mean the proper signature?
>
I think in this case, he's referring to Python ... the def line of the
function specifies its parameters (or arguments, if you prefer). Code that
calls t
perhaps an example can make it clear
e.g.
def __after_insert_auth_user(f, id):
db.profile.insert(username = f.username, first_name = f.first_name,
last_name = f.last_name, email = f.email)
def __after_update_auth_user(s, f):
auth_user = s.select().first()
db(db.profile.auth_user == auth_user.id).
Thanks Anthony but what does it mean the proper signature?
def add_phplist_user(f,id):
auth_user = db.auth_user(id)
#add user
db_phplist.phplist_user_user.insert(
email = auth_user.email,
confirmed = auth_user.newsletter)
db.auth_user._after_insert.append(lambda f,id:
Note, if you function already has the proper signature, there is no reason
to wrap it in a lambda. Also, your callbacks do not have to return an empty
dictionary (they are not controller actions).
Anthony
On Tuesday, October 20, 2015 at 9:19:20 AM UTC-4, Gael Princivalle wrote:
>
> Thanks Niphl
Thanks Niphlod.
After insert works great:
def add_phplist_user(f,id):
auth_user = db.auth_user(id)
#add user
db_phplist.phplist_user_user.insert(
email = auth_user.email,
confirmed = auth_user.newsletter)
return dict()
db.auth_user._after_insert.append(lambda f,id:
see the manual about database callbacks.
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#callbacks-on-record-insert--delete-and-update
On Tuesday, October 20, 2015 at 11:49:02 AM UTC+2, Gael Princivalle wrote:
>
> Hello all.
>
> I would like to run a function everytim
6 matches
Mail list logo