Hey guys! Nowadays I'm using a some filter_outs but they got update and
insert erros on record versioning.
I'm solving update issue using before_update like this:
def remove_filter(s,field):
field_obj = s.query.db[str(s.query).split('.')[0][1:]][field]
field_obj.filter_out = ''
for t in db.tables:
db[t]._before_update.insert(0, lambda s, f: not [remove_filter(s,
field) for field in f])
s.query.db is the returned db;
str(s.query).split('.')[0][1:] is an ugly way to get table name
field is the field_name.
With update I got an ugly solution, but I got a solution. With insert I
can't do it because before_insert don't have a Query object and I can't get
table name
Is there a better way to solve it and remove filter_outs before inserts and
updates?
--
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.