# HG changeset patch # User Julien Cristau # Date 1455616358 -3600 # Node ID 468b91aabd9d6719bd0437f46a7a2e68b30905a0 # Parent 7eb9e3e254bc8aaa8fb4252fa52b5c1000072d9e [web/views] fix editcontroller regression unittest_views_basecontrollers.py's EditControllerTC.test_edit_mandatory_inlined3_object regressed with changeset dcbb64d3a1d9 because it relied on POSTing nonexisting eids. This seems like a silly idea, but let's keep the behaviour unchanged. diff -r 7eb9e3e254bc -r 468b91aabd9d web/views/editcontroller.py --- a/web/views/editcontroller.py Wed Feb 03 15:12:32 2016 +0100 +++ b/web/views/editcontroller.py Tue Feb 16 10:52:38 2016 +0100 @@ -27,7 +27,7 @@ from rql.utils import rqlvar_maker -from cubicweb import Binary, ValidationError +from cubicweb import Binary, ValidationError, UnknownEid from cubicweb.view import EntityAdapter from cubicweb.predicates import is_instance from cubicweb.web import (INTERNAL_FIELD_VALUE, RequestError, NothingToEdit, @@ -340,8 +340,13 @@ web/test/unittest_application.py. """ rschema = self._cw.vreg.schema.rschema(field.name) - new_value_etypes = set(self._cw.entity_from_eid(eid).cw_etype - for eid in new_values) + new_value_etypes = set() + # the user could have included nonexisting eids in the POST; don't crash. + for eid in new_values: + try: + new_value_etypes.add(self._cw.entity_from_eid(eid).cw_etype) + except UnknownEid: + continue for unlinked_eid in removed_values: unlinked_entity = self._cw.entity_from_eid(unlinked_eid) rdef = rschema.role_rdef(form.edited_entity.cw_etype,