A list is a list, doesn't matter if your setting it to a new list or using the list.append() afterwords, it will work the same.
db.table.field.after_update = [] db.table.field.after_update = [lambda row: print row] db.table.field.after_update.append(lambda row: del row) -Thadeus On Tue, Nov 3, 2009 at 3:37 PM, Jon Romero <[email protected]> wrote: > > ok, I hacked an after_update attribute in sql.py but I am doing this: > > db.table.field.after_update = a_list_with_functions > > I think it feels more natural. What do you guys think? > > On Nov 3, 10:58 pm, Thadeus Burgess <[email protected]> wrote: > > after_update should be a list of functions, that take one argument, the > row. > > > > db.table.field.after_update.append(lambda row: print row) > > > > -Thadeus > > > > On Tue, Nov 3, 2009 at 2:56 PM, Jon Romero <[email protected]> wrote: > > > > > Is it possible to do something like that in the db declarations or I > > > have to put code inside the controller? > > > For example in Rails you specify functions that will run before or > > > after an insert/update/delete/select inside the declaration of model. > > > That makes the code very easy to read/reuse. > > > > > I think that it is easy to do this in web2py if you put something like > > > that: > > > db.table_name.table_field.after_update = function_do_something > > > > > Any ideas? > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

