just curious what happen when i put function def or lambda on models when running web2py with profiler *e.g. 1* *models/db.py* # login onfail create new record on auth_event def login_onfail(form): username = request.vars.username row = db((db.auth_user.username == username ) ).iterselect(cache = cache_db, cacheable = True).first() if row is not None: test_event.onfail_event(row.id, row.username)
auth.settings.login_onfail.append(login_onfail) why this is not loaded when hit defaults/user (not trying to login yet) (checked during running snakeviz) ? *e.g. 2* *models/db.py* def before_insert_person(f): if f['auth_user']: query_auth_user = (db.auth_user.id == f['auth_user'] ) row_auth_user = db(query_auth_user).iterselect(cache = (cache.ram, 3600), cacheable = True).first() f['username'] = row_auth_user.username f['first_name'] = row_auth_user.first_name f['last_name'] = row_auth_user.last_name f['email'] = row_auth_user.email def on_define_person(table): #table._before_insert.append(test_define_table.before_insert_person) table._before_insert.append(before_insert_person) db.define_table('person', Field('is_auth', 'boolean'), Field('auth_user', 'reference auth_user'), Field('username'), Field('first_name'), Field('last_name'), Field('email', 'list:string'), on_define = on_define_person, format = lambda r: '%s %s' % (r.first_name, r.last_name) ) when checked during running snakeviz : 1. why before_insert_person is loaded when put it on models, and not loaded when put it on modules? 2. why on_define is loaded whether put it on models or modules? any idea or explaination about that? thanks and best regards, stifan -- 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/d/optout.