diff --git a/hitcount/conf/__init__.py b/hitcount/conf/__init__.py index 8ac55a5..5e3fc7c 100644 --- a/hitcount/conf/__init__.py +++ b/hitcount/conf/__init__.py @@ -10,7 +10,7 @@ def _setup(self): self._wrapped = Settings(app_settings, django_settings) -DEPRECATED_SETTINGS = { +_DEPRECATED_SETTINGS_DJANGO = { 'USE_TZ' if django.VERSION > (4, 0) else None, 'PASSWORD_RESET_TIMEOUT_DAYS' if django.VERSION > (3, 0) else None, 'DEFAULT_CONTENT_TYPE' if django.VERSION > (2, 2) else None, @@ -24,7 +24,7 @@ def __init__(self, *args): setattr(self, attr, getattr(item, attr)) for item in args for attr in dir(item) - if attr == attr.upper() and attr.upper() not in DEPRECATED_SETTINGS + if attr == attr.upper() and attr.upper() not in _DEPRECATED_SETTINGS_DJANGO ] diff --git a/hitcount/utils.py b/hitcount/utils.py index 60c2520..e0c3512 100644 --- a/hitcount/utils.py +++ b/hitcount/utils.py @@ -1,11 +1,10 @@ -import re - from django.apps import apps +from django.utils.regex_helper import _lazy_re_compile from hitcount.conf import settings # this is not intended to be an all-knowing IP address regex -IP_RE = re.compile(r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}') +IP_RE = _lazy_re_compile(r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}') def get_ip(request):