diff --git a/axes/__init__.py b/axes/__init__.py index 9fb718d..c52709d 100644 --- a/axes/__init__.py +++ b/axes/__init__.py @@ -1,43 +1,6 @@ -import os -import logging - -VERSION = (1, 3, 2) +VERSION = (1, 3, 3) def get_version(): return '%s.%s.%s' % VERSION - -try: - # check for existing logging configuration - # valid for Django>=1.3 - from django.conf import settings - if settings.LOGGING: - pass -except ImportError: - # if we have any problems, we most likely don't have a settings module - # loaded - pass -except AttributeError: - # fallback configuration if there is no logging configuration - LOGFILE = os.path.join(settings.DIRNAME, 'axes.log') - - log_format = '%(asctime)s %(name)-12s %(levelname)-8s %(message)s' - logging.basicConfig(level=logging.DEBUG, - format=log_format, - datefmt='%a, %d %b %Y %H:%M:%S', - filename=LOGFILE, - filemode='w') - - fileLog = logging.FileHandler(LOGFILE, 'w') - fileLog.setLevel(logging.DEBUG) - - # set a format which is simpler for console use - console_format = '%(asctime)s %(name)-12s: %(levelname)-8s %(message)s' - formatter = logging.Formatter(console_format) - - # tell the handler to use this format - fileLog.setFormatter(formatter) - - # add the handler to the root logger - logging.getLogger('').addHandler(fileLog) diff --git a/axes/decorators.py b/axes/decorators.py index de6809f..e50d79a 100644 --- a/axes/decorators.py +++ b/axes/decorators.py @@ -2,7 +2,6 @@ import logging from datetime import timedelta -from django import template from django.conf import settings from django.contrib.auth import logout from django.core.exceptions import ObjectDoesNotExist @@ -12,11 +11,11 @@ from django.http import HttpResponseRedirect from django.shortcuts import render_to_response from django.template import RequestContext from django.utils import timezone as datetime -from django.utils.translation import ugettext_lazy, ugettext as _ +from django.utils.translation import ugettext_lazy try: from django.contrib.auth import get_user_model -except ImportError: # django < 1.5 +except ImportError: # django < 1.5 from django.contrib.auth.models import User else: User = get_user_model() @@ -35,7 +34,7 @@ LOCK_OUT_AT_FAILURE = getattr(settings, 'AXES_LOCK_OUT_AT_FAILURE', True) USE_USER_AGENT = getattr(settings, 'AXES_USE_USER_AGENT', False) -# see if the django app is sitting behind a reverse proxy +# see if the django app is sitting behind a reverse proxy BEHIND_REVERSE_PROXY = getattr(settings, 'AXES_BEHIND_REVERSE_PROXY', False) # if the django app is behind a reverse proxy, look for the ip address using this HTTP header value