Code

Opened 3 years ago

Closed 2 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: carljm
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 3 years ago.
15169.2.diff (4.1 KB) - added by ramiro 2 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 Changed 3 years ago by zmsmith

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Summary changed from With gis.mysql backend BooleanField convert to Python as 1|0 instead of Treu|False to With gis.mysql backend BooleanField convert to Python as 1|0 instead of True|False

comment:2 Changed 3 years ago by adamnelson

Might be related to #15040

Replicated on 1.3.0 alpha

comment:3 Changed 3 years ago by russellm

  • Triage Stage changed from Unreviewed to Accepted

Changed 3 years ago by jbronn

comment:4 Changed 3 years ago by jbronn

  • Owner changed from nobody to jbronn
  • Status changed from new to assigned

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 Changed 3 years ago by jbronn

  • milestone set to 1.3

comment:6 Changed 3 years ago by jbronn

  • milestone changed from 1.3 to 1.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 Changed 3 years ago by lrekucki

  • Severity set to Normal
  • Type set to Bug

comment:8 Changed 3 years ago by jacob

  • milestone 1.4 deleted

Milestone 1.4 deleted

comment:2 Changed 2 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:3 Changed 2 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:4 Changed 2 years ago by carljm

  • Severity changed from Normal to Release 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 Changed 2 years ago by ramiro

  • Resolution set to fixed
  • Status changed from assigned to closed

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 Changed 2 years ago by ramiro

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 Changed 2 years ago by ramiro

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:14 Changed 2 years ago by aaugustin

  • Owner changed from jbronn to carljm
  • Status changed from reopened to new

Changed 2 years ago by ramiro

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

comment:15 Changed 2 years ago by aaugustin

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

comment:16 Changed 2 years ago by carljm

  • Resolution set to fixed
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.