Hi guys, I just wanted to confirm this.
The web2py book (link =
http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#callbacks-on-record-insert-delete-and-update)
says:
"The return values of these callback should be None or False. If any of the
_before_* callback returns a True value it will abort the actual
insert/update/delete operation."
But my experience differs, I am comparing the value in db ("query set") and
the value I am about to insert ("fields").
CRITERION: If the "query set" is a smaller value, abort the update
operation.
So, per the instruction in the web2py book, I made it like so:
db.table._before_update.append(lambda s,f: qs(number)<f['number'])
which means the "query set" is smaller than the "fields", then, it's TRUE,
so, abort update.
But it didn't work until I switched the operator sign to make the statement
FALSE, like so:
db.table._before_update.append(lambda s,f: qs(number)>f['number'])
which means the "query set" is NOT smaller than the "fields". It would
abort update.
Am I confused about something or does the web2py book need an edit/update?
Thank you for reading!
--
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/d/optout.