[Django] #33442: contrib.gis.geoip does not support Country-Lite version from DBIP

48 views
Skip to first unread message

Django

unread,
Jan 14, 2022, 9:05:49 AM1/14/22
to django-...@googlegroups.com
#33442: contrib.gis.geoip does not support Country-Lite version from DBIP
---------------------------------------+------------------------
Reporter: DonkeyOatie | Owner: nobody
Type: Bug | Status: new
Component: GIS | Version: 4.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
---------------------------------------+------------------------
The
{{{
db_type
}}}
property of the geoip database metadata for the dbip (https://db-
ip.com/db/lite.php) lite databases is being returned as "DBIP-Country-
Lite"

The check here then fails

https://github.com/django/django/blob/stable/3.2.x/django/contrib/gis/geoip2/base.py#L107

despite the database being in the mmdb format.

I believe Django should support the (free) dbip lite databases as well as
the commercial maxmind databases.

Changing the above line to check for

{{{
if db_type.contains("Country"):
...
}}}

would be sufficient. As would a second check to check for

{{{
if db_type.endswith("Country-") or db_type.endswith("Country-Lite"):
...
}}}

A similar change would be required the the dbip City-Lite database to be
supported.

--
Ticket URL: <https://code.djangoproject.com/ticket/33442>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 14, 2022, 9:24:46 AM1/14/22
to django-...@googlegroups.com
#33442: contrib.gis.geoip does not support Country-Lite version from DBIP
-----------------------------+--------------------------------------

Reporter: DonkeyOatie | Owner: nobody
Type: Bug | Status: new
Component: GIS | Version: 4.0
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
Description changed by DonkeyOatie:

Old description:

> The
> {{{
> db_type
> }}}
> property of the geoip database metadata for the dbip (https://db-
> ip.com/db/lite.php) lite databases is being returned as "DBIP-Country-
> Lite"
>
> The check here then fails
>
> https://github.com/django/django/blob/stable/3.2.x/django/contrib/gis/geoip2/base.py#L107
>
> despite the database being in the mmdb format.
>
> I believe Django should support the (free) dbip lite databases as well as
> the commercial maxmind databases.
>
> Changing the above line to check for
>
> {{{
> if db_type.contains("Country"):
> ...
> }}}
>
> would be sufficient. As would a second check to check for
>
> {{{
> if db_type.endswith("Country-") or db_type.endswith("Country-Lite"):
> ...
> }}}
>
> A similar change would be required the the dbip City-Lite database to be
> supported.

New description:

The
{{{
db_type
}}}
property of the geoip database metadata for the dbip (https://db-
ip.com/db/lite.php) lite databases is being returned as "DBIP-Country-
Lite"

The check here then fails

https://github.com/django/django/blob/stable/3.2.x/django/contrib/gis/geoip2/base.py#L107

despite the database being in the mmdb format.

I believe Django should support the (free) dbip lite databases as well as
the commercial maxmind databases.

Changing the above line to check for

{{{
if db_type.contains("Country"):
...
}}}

would be sufficient. As would a second check to check for

{{{
if db_type.endswith("Country") or db_type.endswith("Country-Lite"):
...
}}}

A similar change would be required the the dbip City-Lite database to be
supported.

I am happy to put in a pull request but I am also hoping we can find a way
to get this into the 3.2.x branch as well as a future 4.x release if thats
possible.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/33442#comment:1>

Django

unread,
Jan 14, 2022, 11:10:26 AM1/14/22
to django-...@googlegroups.com
#33442: contrib.gis.geoip does not support Country-Lite version from DBIP
----------------------------------+------------------------------------
Reporter: Nathan Humphreys | Owner: nobody
Type: New feature | Status: new
Component: GIS | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+------------------------------------
Changes (by Claude Paroz):

* version: 4.0 => dev
* type: Bug => New feature
* stage: Unreviewed => Accepted


Comment:

A patch is welcome. Unfortunately, per Django release policy, this will
not enter 3.2.x, nor 4.0.x, as it's not a regression.

--
Ticket URL: <https://code.djangoproject.com/ticket/33442#comment:2>

Django

unread,
Jul 29, 2022, 2:35:23 PM7/29/22
to django-...@googlegroups.com
#33442: contrib.gis.geoip does not support Country-Lite version from DBIP
----------------------------------+----------------------------------------
Reporter: Nathan Humphreys | Owner: Claude Paroz
Type: New feature | Status: assigned

Component: GIS | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+----------------------------------------
Changes (by Mariusz Felisiak):

* owner: nobody => Claude Paroz
* needs_docs: 0 => 1
* has_patch: 0 => 1
* status: new => assigned


Comment:

[https://github.com/django/django/pull/15892 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/33442#comment:3>

Django

unread,
Jul 30, 2022, 1:36:53 PM7/30/22
to django-...@googlegroups.com
#33442: contrib.gis.geoip does not support Country-Lite version from DBIP
-------------------------------------+-------------------------------------

Reporter: Nathan Humphreys | Owner: Claude
| Paroz
Type: New feature | Status: assigned
Component: GIS | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_docs: 1 => 0
* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/33442#comment:4>

Django

unread,
Jul 30, 2022, 2:00:22 PM7/30/22
to django-...@googlegroups.com
#33442: contrib.gis.geoip does not support Country-Lite version from DBIP
-------------------------------------+-------------------------------------
Reporter: Nathan Humphreys | Owner: Claude
| Paroz
Type: New feature | Status: closed
Component: GIS | Version: dev
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"1e5bbbb2a866faf56e00eb744ab940e40e87d497" 1e5bbbb2]:
{{{
#!CommitTicketReference repository=""
revision="1e5bbbb2a866faf56e00eb744ab940e40e87d497"
Fixed #33442 -- Allowed GeoIP2 to use DB-IP Lite datasets.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33442#comment:5>

Django

unread,
Oct 14, 2024, 8:57:35 PM10/14/24
to django-...@googlegroups.com
#33442: contrib.gis.geoip does not support Country-Lite version from DBIP
-------------------------------------+-------------------------------------
Reporter: Nathan Humphreys | Owner: Claude
| Paroz
Type: New feature | Status: closed
Component: GIS | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by HomingHamster):

Fix appears to be reverted in 5.1.2

I get the following error:

{{{
django.contrib.gis.geoip2.GeoIP2Exception: Unable to handle database
edition: DBIP-City-Lite
}}}

Unless i manually make the changes this ticket suggests.
--
Ticket URL: <https://code.djangoproject.com/ticket/33442#comment:6>

Django

unread,
Oct 15, 2024, 2:39:25 AM10/15/24
to django-...@googlegroups.com
#33442: contrib.gis.geoip does not support Country-Lite version from DBIP
-------------------------------------+-------------------------------------
Reporter: Nathan Humphreys | Owner: Claude
| Paroz
Type: New feature | Status: new
Component: GIS | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz):

* resolution: fixed =>
* status: closed => new

Comment:

Probably broken by 40b5b1596f7505416bd30d5d7582b5a9004ea7d5
--
Ticket URL: <https://code.djangoproject.com/ticket/33442#comment:7>

Django

unread,
Oct 15, 2024, 3:43:12 AM10/15/24
to django-...@googlegroups.com
#33442: contrib.gis.geoip does not support Country-Lite version from DBIP
-------------------------------------+-------------------------------------
Reporter: Nathan Humphreys | Owner: Claude
| Paroz
Type: New feature | Status: new
Component: GIS | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Nick Pope):

Yes, quite likely. Unfortunately 1e5bbbb2a866faf56e00eb744ab940e40e87d497
didn't include any tests. Am looking at a fix for this now.
--
Ticket URL: <https://code.djangoproject.com/ticket/33442#comment:8>

Django

unread,
Oct 15, 2024, 3:52:26 AM10/15/24
to django-...@googlegroups.com
#33442: contrib.gis.geoip does not support Country-Lite version from DBIP
-------------------------------------+-------------------------------------
Reporter: Nathan Humphreys | Owner: Claude
| Paroz
Type: New feature | Status: new
Component: GIS | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Claude Paroz):

Absolutely, a regression test was missing and would be nice!
--
Ticket URL: <https://code.djangoproject.com/ticket/33442#comment:9>

Django

unread,
Oct 15, 2024, 6:37:51 AM10/15/24
to django-...@googlegroups.com
#33442: contrib.gis.geoip does not support Country-Lite version from DBIP
----------------------------------+----------------------------------------
Reporter: Nathan Humphreys | Owner: Claude Paroz
Type: New feature | Status: new
Component: GIS | Version: dev
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+----------------------------------------
Changes (by Sarah Boyce):

* severity: Normal => Release blocker
* stage: Ready for checkin => Accepted

--
Ticket URL: <https://code.djangoproject.com/ticket/33442#comment:10>

Django

unread,
Oct 15, 2024, 7:07:05 AM10/15/24
to django-...@googlegroups.com
#33442: contrib.gis.geoip does not support Country-Lite version from DBIP
----------------------------------+-------------------------------------
Reporter: Nathan Humphreys | Owner: Nick Pope
Type: New feature | Status: assigned
Component: GIS | Version: dev
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* has_patch: 1 => 0
* owner: Claude Paroz => Nick Pope
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/33442#comment:11>

Django

unread,
Oct 15, 2024, 8:43:58 AM10/15/24
to django-...@googlegroups.com
#33442: contrib.gis.geoip does not support Country-Lite version from DBIP
----------------------------------+-------------------------------------
Reporter: Nathan Humphreys | Owner: Nick Pope
Type: New feature | Status: assigned
Component: GIS | Version: dev
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+-------------------------------------
Comment (by Mariusz Felisiak):

If it's a regression we should open a separate ticket for it.
--
Ticket URL: <https://code.djangoproject.com/ticket/33442#comment:12>

Django

unread,
Oct 15, 2024, 11:56:54 AM10/15/24
to django-...@googlegroups.com
#33442: contrib.gis.geoip does not support Country-Lite version from DBIP
-------------------------------------+-------------------------------------
Reporter: Nathan Humphreys | Owner: Nick Pope
Type: New feature | Status: closed
Component: GIS | Version: dev
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Nick Pope):

* has_patch: 0 => 1
* resolution: => fixed
* severity: Release blocker => Normal
* stage: Accepted => Ready for checkin
* status: assigned => closed

Comment:

Moved regression to ticket #35841.
--
Ticket URL: <https://code.djangoproject.com/ticket/33442#comment:13>
Reply all
Reply to author
Forward
0 new messages