Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#25597 closed Bug (fixed)

Python 3 compatibility error in PostgreSQL array form fields

Reported by: Bertrand Bordage Owned by: Tim Graham <timograham@…>
Component: contrib.postgres Version: 1.8
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

django.contrib.postgres.forms.array uses several times the old Exception.message attribute to get the error message instead of str(Exception). This breaks compatibility with Python 3 at least when using SplitArrayField, but it should also lead to errors on other form fields from this module.

Minimal example:

from django.contrib.postgres.forms import SplitArrayField
from django.forms import IntegerField

SplitArrayField(IntegerField(max_value=100), size=2).clean([0, 101])

This leads to an AttributeError: 'ValidationError' object has no attribute 'message'

Change History (5)

comment:1 by Tim Graham, 9 years ago

Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted
Version: master1.8

comment:2 by Tim Graham, 9 years ago

Has patch: set

comment:3 by Tim Graham <timograham@…>, 9 years ago

Owner: set to Tim Graham <timograham@…>
Resolution: fixed
Status: newclosed

In 1f07da3e:

Fixed #25597 -- Fixed crash with SplitArrayField and IntegerField on invalid value.

comment:4 by Tim Graham <timograham@…>, 9 years ago

In 69e6045c:

[1.8.x] Fixed #25597 -- Fixed crash with SplitArrayField and IntegerField on invalid value.

Backport of 1f07da3e29c7c3d47968e1c4531dd9bf902575b7 from master

comment:5 by Tim Graham <timograham@…>, 9 years ago

In 64a9115b:

[1.9.x] Fixed #25597 -- Fixed crash with SplitArrayField and IntegerField on invalid value.

Backport of 1f07da3e29c7c3d47968e1c4531dd9bf902575b7 from master

Note: See TracTickets for help on using tickets.
Back to Top