diff --git a/django/contrib/gis/geoip2/base.py b/django/contrib/gis/geoip2/base.py index 7d17766c25..292acc55e6 100644 --- a/django/contrib/gis/geoip2/base.py +++ b/django/contrib/gis/geoip2/base.py @@ -68,9 +68,7 @@ class GeoIP2: 'GeoLite2-City.mmdb'; overrides the GEOIP_CITY setting. """ # Checking the given cache option. - if cache in self.cache_options: - self._cache = cache - else: + if cache not in self.cache_options: raise GeoIP2Exception('Invalid GeoIP caching option: %s' % cache) # Getting the GeoIP data path.