web/views/editcontroller.py
changeset 5575 8a531340c3ef
parent 5569 cb14af012a96
child 5676 aa04ccb8dd62
equal deleted inserted replaced
5574:e082a57c2207 5575:8a531340c3ef
   158             raise ValidationError(valerror_eid(form.get('__maineid')), errors)
   158             raise ValidationError(valerror_eid(form.get('__maineid')), errors)
   159 
   159 
   160     def _insert_entity(self, etype, eid, rqlquery):
   160     def _insert_entity(self, etype, eid, rqlquery):
   161         rql = rqlquery.insert_query(etype)
   161         rql = rqlquery.insert_query(etype)
   162         try:
   162         try:
   163             # get the new entity (in some cases, the type might have
       
   164             # changed as for the File --> Image mutation)
       
   165             entity = self._cw.execute(rql, rqlquery.kwargs).get_entity(0, 0)
   163             entity = self._cw.execute(rql, rqlquery.kwargs).get_entity(0, 0)
   166             neweid = entity.eid
   164             neweid = entity.eid
   167         except ValidationError, ex:
   165         except ValidationError, ex:
   168             self._to_create[eid] = ex.entity
   166             self._to_create[eid] = ex.entity
   169             if self._cw.json_request: # XXX (syt) why?
   167             if self._cw.json_request: # XXX (syt) why?