cubicweb #2845392 complete linkto API [open]

Currently we pass data to "prelink" an existing entity to a to-be-created entity to the forms/editcontroller machinery using the:

  • __linkto form element
  • .linked_to (-> map of (rtype, role) to eids) method on forms(fields)
  • ltinfos parameter to entity.enrelated(...)

There however lacks an API to populate/write the __linkto. I've seen hacks such as __linkto = [l1, l2], __linkto = '%s:%s:%s' % (....) and they all basically override exiting linkto information, which can lead to subtle and painful bugs.

Hence the need of an API such as:

with prelink_to(self._cw.form) as prelink:
   prelink.append(rtype, role, eid)

That would create the element if absent, append to it if not.

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