Opened 14 years ago

Closed 13 years ago

#15169 closed Bug (fixed)

With gis.mysql backend BooleanField convert to Python as 1|0 instead of True|False

Reported by: zmsmith Owned by: Carl Meyer
Component: GIS Version: 1.2
Severity: Release blocker Keywords: BooleanField, GIS,
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Using the django.contrib.gis.db.backends.mysql database backend, BooleanField are retrieved as 1 or 0 instead of proper python True or False

Attachments (2)

15169.1.diff (6.1 KB ) - added by jbronn 14 years ago.
15169.2.diff (4.1 KB ) - added by Ramiro Morales 13 years ago.
New attempt, using a strategy similar to the one used by the main MySQL DB backend

Download all attachments as: .zip

Change History (19)

comment:1 by zmsmith, 14 years ago

Summary: With gis.mysql backend BooleanField convert to Python as 1|0 instead of Treu|FalseWith gis.mysql backend BooleanField convert to Python as 1|0 instead of True|False

comment:2 by Adam Nelson, 14 years ago

Might be related to #15040

Replicated on 1.3.0 alpha

comment:3 by Russell Keith-Magee, 14 years ago

Triage Stage: UnreviewedAccepted

by jbronn, 14 years ago

Attachment: 15169.1.diff added

comment:4 by jbronn, 14 years ago

Owner: changed from nobody to jbronn
Status: newassigned

So, I wasn't aware that Django's MySQL backend got its own compiler module last spring -- thus, proper subclasses need to be created in django.contrib.gis.db.backends.mysql.compiler.

My initial patch fixes the problem, and moves the actual value conversion in the MySQL backend to convert_values -- this is consistent with the approach taken in Oracle's backend, and makes it easier for GeoDjango to use. However, this initial patch causes a regression in GeoDjango's relatedapp tests, but this could be related to #15040.

comment:5 by jbronn, 14 years ago

milestone: 1.3

comment:6 by jbronn, 14 years ago

milestone: 1.31.4

This is not a blocker, and is being pushed to 1.4 at latest (most likely a bug fix in 1.3.X after release).

comment:7 by Łukasz Rekucki, 14 years ago

Severity: Normal
Type: Bug

comment:8 by Jacob, 13 years ago

milestone: 1.4

Milestone 1.4 deleted

comment:2 by Aymeric Augustin, 13 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:3 by Aymeric Augustin, 13 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:4 by Carl Meyer, 13 years ago

Severity: NormalRelease blocker

Marking this as a release blocker, since in combination with r17132 it is effectively a serious regression in 1.4 (see #17747, closed as duplicate).

comment:5 by Ramiro Morales, 13 years ago

Resolution: fixed
Status: assignedclosed

In [17588]:

Fixed #15169 -- Corrected handling of model boolean fields in MySQL spatial backend.

Thanks goes to zmsmith and others for reporting the issue and to Justin Bronn for the fix.

Refs #7190, r12578, r12900, #13293, r12939.

comment:12 by Ramiro Morales, 13 years ago

In [17603]:

Fixed #17796 -- Rolled back [17588] because the fix for the original relatively
corner case (boolean fields under MySQL spatial backend) had a wider scope with
potentially unintended consequences affecting the main MySQL backend and the
required changes wouldn't be appropiate at this point of the 1.4 development
cycle.

Refs #15169.

comment:13 by Ramiro Morales, 13 years ago

Resolution: fixed
Status: closedreopened

comment:14 by Aymeric Augustin, 13 years ago

Owner: changed from jbronn to Carl Meyer
Status: reopenednew

by Ramiro Morales, 13 years ago

Attachment: 15169.2.diff added

New attempt, using a strategy similar to the one used by the main MySQL DB backend

comment:15 by Aymeric Augustin, 13 years ago

ci.djangoproject.com now runs tests with the MySQL GIS backend :)

comment:16 by Carl Meyer, 13 years ago

Resolution: fixed
Status: newclosed

In [17632]:

Fixed #15169 -- Added conversion of 0/1 to False/True for MySQL GIS backend. Thanks zmsmith for report, and Ramiro for draft patch and review.

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