Skip to content

Commit

Permalink
Add six imports for Django master compatibility
Browse files Browse the repository at this point in the history
Implement forwards compatibility for missing
django.utils.six package imports on Django 2.2

Relates to django-compressor/django-appconf#44
and can be removed after django-appconf
has received a new release which deprecates
the use of the integrated Django six library

Signed-off-by: Aleksi Häkli <aleksi.hakli@iki.fi>
  • Loading branch information
aleksihakli committed Feb 24, 2019
1 parent fc32a00 commit f2ebe08
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions axes/conf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# TODO: Remove these imports after django-appconf does not depend on django.utils.six
try:
from django.utils import six # noqa
except ImportError:
import sys
import warnings

sys.modules['django.utils.six'] = __import__('six')
warnings.warn('django.utils.six was patched for django-appconf backwards compatibility', ImportWarning)

from django.conf import settings
from django.utils.translation import gettext_lazy as _

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@
package_dir={'axes': 'axes'},
python_requires='~=3.5',
install_requires=[
'pytz',
'django',
'django-appconf',
'django-ipware>=2.0.2',
'pytz',
'six',
],
include_package_data=True,
packages=find_packages(),
Expand Down

0 comments on commit f2ebe08

Please sign in to comment.