diff options
| author | Ramiro Morales <cramm0@gmail.com> | 2011-06-09 20:01:28 +0000 |
|---|---|---|
| committer | Ramiro Morales <cramm0@gmail.com> | 2011-06-09 20:01:28 +0000 |
| commit | dff31de20aac85e4f4834c2466762cbf23fc0a7b (patch) | |
| tree | 6d7d6756f53eb599b81827bf097f24cfb1ed7b54 /django/utils | |
| parent | da0c7cd7778ee99a31587276faee30e94a8255ae (diff) | |
Fixed #16155 -- Removed Python 2.4 compatibility constructs from code and mentions from docs. Thanks Aymeric Augustin for the report and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16349 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils')
| -rw-r--r-- | django/utils/hashcompat.py | 21 | ||||
| -rw-r--r-- | django/utils/http.py | 4 | ||||
| -rw-r--r-- | django/utils/itercompat.py | 2 | ||||
| -rw-r--r-- | django/utils/translation/trans_real.py | 3 |
4 files changed, 10 insertions, 20 deletions
diff --git a/django/utils/hashcompat.py b/django/utils/hashcompat.py index 57435b14be..b11fa0a686 100644 --- a/django/utils/hashcompat.py +++ b/django/utils/hashcompat.py @@ -3,22 +3,13 @@ The md5 and sha modules are deprecated since Python 2.5, replaced by the hashlib module containing both hash algorithms. Here, we provide a common interface to the md5 and sha constructors, depending on system version. """ -import sys -import warnings +import warnings warnings.warn("django.utils.hashcompat is deprecated; use hashlib instead", PendingDeprecationWarning) -if sys.version_info >= (2, 5): - import hashlib - md5_constructor = hashlib.md5 - md5_hmac = md5_constructor - sha_constructor = hashlib.sha1 - sha_hmac = sha_constructor -else: - import md5 - md5_constructor = md5.new - md5_hmac = md5 - import sha - sha_constructor = sha.new - sha_hmac = sha +import hashlib +md5_constructor = hashlib.md5 +md5_hmac = md5_constructor +sha_constructor = hashlib.sha1 +sha_hmac = sha_constructor diff --git a/django/utils/http.py b/django/utils/http.py index 4b43e5835e..07e96b9ba6 100644 --- a/django/utils/http.py +++ b/django/utils/http.py @@ -198,8 +198,8 @@ if sys.version_info >= (2, 6): p1, p2 = urlparse.urlparse(url1), urlparse.urlparse(url2) return (p1.scheme, p1.hostname, p1.port) == (p2.scheme, p2.hostname, p2.port) else: - # Python 2.4, 2.5 compatibility. This actually works for Python 2.6 and - # above, but the above definition is much more obviously correct and so is + # Python 2.5 compatibility. This actually works for Python 2.6 and above, + # but the above definition is much more obviously correct and so is # preferred going forward. def same_origin(url1, url2): """ diff --git a/django/utils/itercompat.py b/django/utils/itercompat.py index 38058e227c..a56b703983 100644 --- a/django/utils/itercompat.py +++ b/django/utils/itercompat.py @@ -7,7 +7,7 @@ these implementations if necessary. import itertools import warnings -# Fallback for Python 2.4, Python 2.5 +# Fallback for Python 2.5 def product(*args, **kwds): """ Taken from http://docs.python.org/library/itertools.html#itertools.product diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py index b497d9e354..9e8285bcf7 100644 --- a/django/utils/translation/trans_real.py +++ b/django/utils/translation/trans_real.py @@ -63,8 +63,7 @@ def to_language(locale): class DjangoTranslation(gettext_module.GNUTranslations): """ This class sets up the GNUTranslations context with regard to output - charset. Django uses a defined DEFAULT_CHARSET as the output charset on - Python 2.4. + charset. """ def __init__(self, *args, **kw): gettext_module.GNUTranslations.__init__(self, *args, **kw) |
