e.g.
modules/test_event.py
def after_insert_event(f, id, table):
time_stamp = current.request.now
client_ip = current.request.client
user_id = current.auth.user_id
origin = '%s/%s' % (current.request.controller, current.request.function)
messages = 'ID %s created in table %s by %s on %s at %s from %s' % (id, table,
user_id, time_stamp,
origin, client_ip)
# insert table event : worked
current.db.auth_event.insert(time_stamp = time_stamp,
client_ip = client_ip,
user_id = user_id,
origin = origin,
description = 'ID %s created in table %s' % (id, table) )
# mail
current.mail.send(mail_to,
messages,
messages)
# insert table event : not worked no error traceback occured, but the result is not expected
current.db.auth_event.insert(time_stamp = time_stamp,
client_ip = client_ip,
user_id = user_id,
origin = origin,
description = 'Email sent to %s ID %s created in table %s' % (mail_to, id, table) )
this code only work for the first insert, the second insert is not work (no error traceback occured, but the result is not expected.)
is there any way to achieve it using web2py way?