[Django] #35100: Simplify initialization of databases in the GeoIP2 wrapper

28 views
Skip to first unread message

Django

unread,
Jan 10, 2024, 6:05:09 AM1/10/24
to django-...@googlegroups.com
#35100: Simplify initialization of databases in the GeoIP2 wrapper
-------------------------------------+-------------------------------------
Reporter: Nick Pope | Owner: Nick Pope
Type: | Status: assigned
Cleanup/optimization |
Component: GIS | Version: dev
Severity: Normal | Keywords: geoip2
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
The initialization of the wrapper around the GeoIP2 databases is
overcomplicated and should be simplified.

Currently when calling `GeoIP2.city()` and `GeoIP2.country()` the city and
country databases will be used respectively, but this is unnecessary as
the country database is merely a subset of the city database. It should be
possible to provide a path and attempt to open a database from three
possible candidates: `path`, `path / city`, and `path / country`. While a
minor incompatibility in that the city database may be used instead, this
also reduces the potential for mixing data from two different databases
where one might be outdated.

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

Django

unread,
Jan 10, 2024, 6:06:55 AM1/10/24
to django-...@googlegroups.com
#35100: Simplify initialization of databases in the GeoIP2 wrapper
-------------------------------------+-------------------------------------
Reporter: Nick Pope | Owner: Nick Pope
Type: | Status: assigned
Cleanup/optimization |
Component: GIS | Version: dev
Severity: Normal | Resolution:
Keywords: geoip2 | Triage Stage:
| Unreviewed
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


Comment:

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

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

Django

unread,
Jan 10, 2024, 6:45:23 AM1/10/24
to django-...@googlegroups.com
#35100: Simplify initialization of databases in the GeoIP2 wrapper
-------------------------------------+-------------------------------------
Reporter: Nick Pope | Owner: Nick Pope
Type: | Status: assigned
Cleanup/optimization |
Component: GIS | Version: dev
Severity: Normal | Resolution:
Keywords: geoip2 | Triage Stage: Accepted

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

* stage: Unreviewed => Accepted


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

Django

unread,
Jan 10, 2024, 6:57:14 AM1/10/24
to django-...@googlegroups.com
#35100: Simplify initialization of databases in the GeoIP2 wrapper
-------------------------------------+-------------------------------------
Reporter: Nick Pope | Owner: Nick Pope
Type: | Status: assigned
Cleanup/optimization |
Component: GIS | Version: dev
Severity: Normal | Resolution:
Keywords: geoip2 | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* needs_better_patch: 0 => 1


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

Django

unread,
Jan 10, 2024, 7:46:51 AM1/10/24
to django-...@googlegroups.com
#35100: Simplify initialization of databases in the GeoIP2 wrapper
-------------------------------------+-------------------------------------
Reporter: Nick Pope | Owner: Nick Pope
Type: | Status: assigned
Cleanup/optimization |
Component: GIS | Version: dev
Severity: Normal | Resolution:
Keywords: geoip2 | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Nick Pope):

* needs_better_patch: 1 => 0


Comment:

Rebased and fixed tests after #35092.

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

Django

unread,
Jan 11, 2024, 4:54:46 AM1/11/24
to django-...@googlegroups.com
#35100: Simplify initialization of databases in the GeoIP2 wrapper
-------------------------------------+-------------------------------------
Reporter: Nick Pope | Owner: Nick Pope
Type: | Status: assigned
Cleanup/optimization |
Component: GIS | Version: dev
Severity: Normal | Resolution:
Keywords: geoip2 | 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):

* stage: Accepted => Ready for checkin


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

Django

unread,
Jan 11, 2024, 6:39:33 AM1/11/24
to django-...@googlegroups.com
#35100: Simplify initialization of databases in the GeoIP2 wrapper
-------------------------------------+-------------------------------------
Reporter: Nick Pope | Owner: Nick Pope
Type: | Status: closed

Cleanup/optimization |
Component: GIS | Version: dev
Severity: Normal | Resolution: fixed

Keywords: geoip2 | 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:"40b5b1596f7505416bd30d5d7582b5a9004ea7d5" 40b5b15]:
{{{
#!CommitTicketReference repository=""
revision="40b5b1596f7505416bd30d5d7582b5a9004ea7d5"
Fixed #35100 -- Reworked GeoIP2 database initialization.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/35100#comment:6>

Django

unread,
Oct 15, 2024, 2:39:34 AM10/15/24
to django-...@googlegroups.com
#35100: Simplify initialization of databases in the GeoIP2 wrapper
-------------------------------------+-------------------------------------
Reporter: Nick Pope | Owner: Nick Pope
Type: | Status: closed
Cleanup/optimization |
Component: GIS | Version: dev
Severity: Normal | Resolution: fixed
Keywords: geoip2 | 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):

Looks like this fix broke #33442 again.
--
Ticket URL: <https://code.djangoproject.com/ticket/35100#comment:7>
Reply all
Reply to author
Forward
0 new messages