# HG changeset patch # User Adrien Di Mascio # Date 1254938386 -7200 # Node ID 5a46e68c3d3c66eff17e7f5f43f7bd2f6eba504b # Parent a7c5e62c7e00b61aa37d1f39515c9d525751c5e0 [editcontroller] backout (sort of) removal of entity.complete() in validate_form entity is passed to js callbacks when there's one. In that case, we want as much information as we can. The removal was there to avoid complete to fail when all constraints (required relations / attributes) aren't satisfied. This fix only does the complete() after the commit is done, any ValidationError should have been raised at this point. diff -r a7c5e62c7e00 -r 5a46e68c3d3c web/views/basecontrollers.py --- a/web/views/basecontrollers.py Wed Oct 07 19:22:34 2009 +0200 +++ b/web/views/basecontrollers.py Wed Oct 07 19:59:46 2009 +0200 @@ -201,6 +201,10 @@ req.exception('unexpected error while validating form') return (False, req._(str(ex).decode('utf-8')), ctrl._edited_entity) else: + # complete entity: it can be used in js callbacks where we might + # want every possible information + if ctrl._edited_entity: + ctrl._edited_entity.complete() return (True, ex.location, ctrl._edited_entity) except Exception, ex: req.cnx.rollback()