[Cubicweb] Insert error message

Jinpeng Li mr.li.jinpeng at gmail.com
Thu Jul 23 16:06:15 CEST 2015

Dear all,

I try to insert an entity, but it failed with an error message as shown

INSERT Subject X: X identifier "002_S_0295" , X related_center C WHERE C
code_in_study "002"

Error message
line 333, in call_hooks


line 259, in __call__


ValidationError: 1999521 (identifier-subject): the value "002_S_0295" is
already used, use another one

I spent a lot of time to check if it exists the Subject
with identifier "002_S_0295" (Any X where X identifier "002_S_0295"), but I
found nothing.

At the end, I follow the traceback message to review the source codes. I
saw the example below.

    def substitute_entity_def(self, edef, edefs):
        """substitute an incomplete entity definition by a list of complete

        e.g. on queries such as ::
          INSERT Personne X, Societe Y: X nom N, Y nom 'toto', X travaille Y
          WHERE U login 'admin', U login N

        X will be inserted as many times as U exists, and so the X
travaille Y
        relations as to be added as many time as X is inserted

I have two same centers (C) in my database. The rql insert Subjects as many
times as C in my rql; that is why it exists two same inserted Subjects. I
think it is better to add a hypothesis error message saying that "it could
be produced by the relations of entities".

My cubicweb version is a little bit old (3.19.3), you may already add these
kinds of message. If it is in this case, please ignore this email.


Software Engineer in Neurospin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20150723/7a7292b9/attachment-0185.html>

More information about the Cubicweb mailing list