Refs #28115 -- Avoided masking legitimate ImportErrors in geoip2 module

This commit is contained in:
Claude Paroz 2017-04-22 16:41:18 +02:00
parent c0f12a098c
commit 257075d4ad
1 changed files with 4 additions and 2 deletions

View File

@ -14,8 +14,10 @@ directory corresponding to settings.GEOIP_PATH.
__all__ = ['HAS_GEOIP2'] __all__ = ['HAS_GEOIP2']
try: try:
import geoip2 # NOQA
except ImportError:
HAS_GEOIP2 = False
else:
from .base import GeoIP2, GeoIP2Exception from .base import GeoIP2, GeoIP2Exception
HAS_GEOIP2 = True HAS_GEOIP2 = True
__all__ += ['GeoIP2', 'GeoIP2Exception'] __all__ += ['GeoIP2', 'GeoIP2Exception']
except ImportError:
HAS_GEOIP2 = False