diff options
| author | Claude Paroz <claude@2xlibre.net> | 2017-04-22 16:41:18 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2017-04-22 20:10:24 +0200 |
| commit | 257075d4adf9ce0fae8ca1ec3c680dc071fa5a72 (patch) | |
| tree | daaa124ff59cc8b400cb5b5011e19fa8e14af4ef | |
| parent | c0f12a098c0258eef3e9af982c17f5ef7f6c927d (diff) | |
Refs #28115 -- Avoided masking legitimate ImportErrors in geoip2 module
| -rw-r--r-- | django/contrib/gis/geoip2/__init__.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/django/contrib/gis/geoip2/__init__.py b/django/contrib/gis/geoip2/__init__.py index b76dfa6ef8..2d7d7a7e92 100644 --- a/django/contrib/gis/geoip2/__init__.py +++ b/django/contrib/gis/geoip2/__init__.py @@ -14,8 +14,10 @@ directory corresponding to settings.GEOIP_PATH. __all__ = ['HAS_GEOIP2'] try: + import geoip2 # NOQA +except ImportError: + HAS_GEOIP2 = False +else: from .base import GeoIP2, GeoIP2Exception HAS_GEOIP2 = True __all__ += ['GeoIP2', 'GeoIP2Exception'] -except ImportError: - HAS_GEOIP2 = False |
