Make EditController edit_entity method always return an eid
In cases the entity was to be created or copied, eid was None hence the method
returned None despite the dosctring says the method should always return an
eid. Now if the eid variable is None, it is assigned to the newly created
entity eid.
Closes #3593029.
--- a/web/views/editcontroller.py Wed Mar 26 11:08:09 2014 +0100
+++ b/web/views/editcontroller.py Wed Feb 26 14:50:13 2014 +0100
@@ -272,7 +272,7 @@
errors = dict((f.role_name(), unicode(ex)) for f, ex in self.errors)
raise ValidationError(valerror_eid(entity.eid), errors)
if eid is None: # creation or copy
- entity.eid = self._insert_entity(etype, formparams['eid'], rqlquery)
+ entity.eid = eid = self._insert_entity(etype, formparams['eid'], rqlquery)
elif rqlquery.edited: # edition of an existant entity
self._update_entity(eid, rqlquery)
if is_main_entity: