#30461: contrib.gis.geoip2 does not support pathlib.Path as GEOIP_PATH 
parameter,
only str
-----------------------------+--------------------------------------
     Reporter:  lsnk         |                    Owner:  nobody
         Type:  New feature  |                   Status:  assigned
    Component:  GIS          |                  Version:  2.2
     Severity:  Normal       |               Resolution:
     Keywords:  geoip2       |             Triage Stage:  Unreviewed
    Has patch:  1            |      Needs documentation:  0
  Needs tests:  0            |  Patch needs improvement:  0
Easy pickings:  1            |                    UI/UX:  0
-----------------------------+--------------------------------------
Description changed by lsnk:

Old description:

> I want to pass Path instance directly as GEOIP_PATH param but currently
> it only allowes str instances.
> As I understand, min Python version for Django 2.2 is 3.5+ so I can
> freely pass Path instance there.
> {{{
> ...
>         # Getting the GeoIP data path.
>         path = path or GEOIP_SETTINGS['GEOIP_PATH']
>         if not path:
>             raise GeoIP2Exception('GeoIP path must be provided via
> parameter or the GEOIP_PATH setting.')
>         if not isinstance(path, str):
>             raise TypeError('Invalid path type: %s' %
> type(path).__name__)
>
>         path = Path(path)
> ...
> }}}
>
> I can fix this issue myself.

New description:

 I want to pass Path instance directly as GEOIP_PATH param but currently it
 only allowes str instances.
 As I understand, min Python version for Django 2.2 is 3.5+ so I can freely
 pass Path instance there.
 {{{
 ...
         # Getting the GeoIP data path.
         path = path or GEOIP_SETTINGS['GEOIP_PATH']
         if not path:
             raise GeoIP2Exception('GeoIP path must be provided via
 parameter or the GEOIP_PATH setting.')
         if not isinstance(path, str):
             raise TypeError('Invalid path type: %s' % type(path).__name__)

         path = Path(path)
 ...
 }}}

 I've fixed this issue myself.
 https://github.com/lsnk/django/tree/ticket_30461_2_2
 https://github.com/django/django/pull/11341

--

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.72876b2b19a091741cd42d6d2d96218d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to