cubicweb/web/views/autoform.py
changeset 11374 0e50215016f3
parent 11339 67373614e125
parent 11151 4259c55df3e7
child 11731 6563113b9caf
--- a/cubicweb/web/views/autoform.py	Thu Jun 23 08:53:21 2016 +0200
+++ b/cubicweb/web/views/autoform.py	Thu Jun 23 15:52:04 2016 +0200
@@ -484,13 +484,19 @@
 
 def _add_pending(req, eidfrom, rel, eidto, kind):
     key = 'pending_%s' % kind
-    pendings = req.session.data.setdefault(key, set())
-    pendings.add( (int(eidfrom), rel, int(eidto)) )
+    pendings = req.session.data.get(key, [])
+    value = (int(eidfrom), rel, int(eidto))
+    if value not in pendings:
+        pendings.append(value)
+        req.session.data[key] = pendings
 
 def _remove_pending(req, eidfrom, rel, eidto, kind):
     key = 'pending_%s' % kind
     pendings = req.session.data[key]
-    pendings.remove( (int(eidfrom), rel, int(eidto)) )
+    value = (int(eidfrom), rel, int(eidto))
+    if value in pendings:
+        pendings.remove(value)
+        req.session.data[key] = pendings
 
 @ajaxfunc(output_type='json')
 def remove_pending_insert(self, args):