If I do this my computed field (that depends on score and created on) is
updated correctly:
def some_other_table_after_insert(f, id):
record = db.table_with_computed_field[f['ref']]
new_score = record.score + f['score']
record.update_record(score=new_score, created_on=record.created_on)
While if I do this, it doesn't work, and I can see that my compute function
is getting Expressions where it should be getting values:
def some_other_table_after_insert(f, id):
db(db.table_with_computed_field.id ==
f['ref']).update(score=db.table_with_computed_field.score + f['score'],
created_on=db.table_with_computed_field.created_on)
Isn't this a bug? Shouldn't the Expressions have been calculated before
getting to the compute function?
I only noticed because my compute was silently not doing anything and I had
to use the traceback module to find what was going on:
AttributeError: 'Expression' object has no attribute 'days'
Clearly caused by the created_on being an Expression instead of the
datetime it should be.
--
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.