cubicweb #17169126 Got "unhashable type list" while creating entity with inlinded relation [open]

With cubicweb 3.25.4, I declared the following my cube's schema:

class HorizonDecomposition(EntityType):
    [...]  # Basic stuff
    name = String(required=True, unique=True, maxsize=64, fulltextindexed=True,

class HorizonDecompositionSection(EntityType):
    [...]  # Basic stuff
    hd_section_of = SubjectRelation('HorizonDecomposition',

Now from the web interface, when I try to create a HorizonDecomposition with one HorizonDecompositionSection (required by cardinality), I get the following issue:

2018-09-24 10:42:02 - (cubicweb.web) ERROR: unexpected error while validating form
Traceback (most recent call last):
  File "/venv/local/lib/python2.7/site-packages/cubicweb/web/views/", line 209, in _validate_form
  File "/venv/local/lib/python2.7/site-packages/cubicweb/web/views/", line 132, in publish
  File "/venv/local/lib/python2.7/site-packages/cubicweb/web/views/", line 198, in _default_publish
    for formparams in self._ordered_formparams():
  File "/venv/local/lib/python2.7/site-packages/cubicweb/web/views/", line 169, in _ordered_formparams
    if target_eid in values_by_eid:
TypeError: unhashable type: 'list'

Also, the part of the creation form that concerns HorizonDecompositionSection shows a selector for "hd_section_of". This should not be as its value will be the HorizonDecomposition that I am currently creating.

Anyway, the following patch in cubicweb avoids the Traceback, but not the view:

diff -r b8567725c473 cubicweb/web/views/
--- a/cubicweb/web/views/  Fri Jan 12 10:48:34 2018 +0100
+++ b/cubicweb/web/views/  Fri Sep 28 11:29:20 2018 +0200
@@ -166,13 +166,13 @@
                             # use .get since param may be unspecified (though it will usually lead
                             # to a validation error later)
                             target_eid = values.get(param)
-                            if target_eid in values_by_eid:
+                            if target_eid is not None and target_eid[0] in values_by_eid:
                                 # add dependency from the target entity to the
                                 # current one
                                 if role == 'object':
-                                    graph.setdefault(target_eid, set()).add(eid)
+                                    graph.setdefault(target_eid[0], set()).add(eid)
-                                    graph.setdefault(eid, set()).add(target_eid)
+                                    graph.setdefault(eid, set()).add(target_eid[0])
         for eid in reversed(ordered_nodes(graph)):
             yield values_by_eid[eid]{code}

Is this code correct ? Can you integrate it asap so my users will not be blocked anymore ?

Many thanks,

Best regards,


done in<not specified>
load left0.250
closed by<not specified>