> I'm trying to automatically count each time a record is being updated. I
> could make a lambda function that worked for a dictionary:
> Field('edits', 'integer', compute=lambda r: int(r['edits'] or 0) + 1 ),
>
> However, I don't get this to work in practice. Can a lambda for edits not
> use its own value?
>
I think you are right in that point, from book:
- compute is an optional function. If a record is inserted or updated,
the compute function will be executed and the field will be populated with
the function result. The record is passed to the compute function as a
dict, and *the dict will not include the current value of that, or any
other compute field.*
--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.