Opened 4 years ago
Last modified 13 months ago
#33442 closed New feature
contrib.gis.geoip does not support Country-Lite version from DBIP — at Initial Version
| Reported by: | Nathan Humphreys | Owned by: | nobody |
|---|---|---|---|
| Component: | GIS | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
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.