IntegrityError not handled properly

Noé Gaumont noe.gaumont at logilab.fr
Tue Feb 11 18:11:25 CET 2020


I forgot to explain the expected behavior and, while checking with 
Élodie, it seems this is also python2 related.


Expected behavior when adding another denomination on /add/Denomiation:

The form used to create the denomination is not validated.
An error is displayed in the webpage saying that the form could not be 
validated because the field name should be unique. There aren't any 
traceback in the log.


Actual behavior (with python2 and CW 3.26.14):

The page freeze because an Exception with an accent is raised (see below).

Actual behavior (with python3 and CW 3.26.14 or 3.27):

An error message is displayed but the error is the raw 
psycopg2.errors.UniqueViolation instead of UniqueTogetherError or 
ViolatedConstraint. There is also the whole traceback in the log.

The python3 behavior is better than in python2 but it's not the expected 
one.


Noé

Le 11/02/2020 à 16:42, Noé Gaumont a écrit :
>
> Hi,
>
> Few month ago, I had an issue on integrityError:
>
> https://www.cubicweb.org/ticket/17255666
>
> The step to reproduce are:
>
>  1. install cubicweb 3.26 (python3)
>  2. create a cube with the following schema:
>
> from yams.buildobjs import (EntityType, String)
>
>
> class Denomination(EntityType):
>      name = String(unique=True, maxsize=256)
>
>
>     3. create an instance based on the new cube and run the instance
>     4. create 2 denomination with the same name
>
> On the second creation, an error is raised with a traceback (see the 
> ticket).
> It seems Élodie was able to reproduce in 3.27.
>
> I'm not sure if this change is caused by psycopg2, a specific postgres 
> version or cubicweb.
> This might need more investigation.
>
>
> Noé
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb-devel/attachments/20200211/2c482a8d/attachment-0187.html>


More information about the cubicweb-devel mailing list