I assume this is in your latest patch. I will try apply it during the
week-end.

On Feb 7, 8:39 am, Robin B <[email protected]> wrote:
> update() and update_record() should accept callables:
>
> def txn(record):
>   attrs = {}
>   if record.name == 'bob':
>     attrs['count'] = record.count + 1
>   elif record.name == 'alice':
>     attrs['count'] = record.count - 1
>   return attrs
>
> #complex transactions
> (db.posts.id>0).update(txn)
>
> # simple transactions
> (db.posts.id>0).update(count=lambda v: v+1)
>
> The benefit of a complex transaction is that the developer can control
> the order attributes are assigned and make complex decisions in side
> the transaction.  Simple transactions can use the shorthand notation
> and put the callable inline.
>
> Robin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to