Re-added a few compatibility modules that were removed in r15927 to lower the impact on 3rd party apps.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15944 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
99b2728b74
commit
37ed6f2681
|
@ -0,0 +1,18 @@
|
|||
"""
|
||||
Fixes Python 2.4's failure to deepcopy unbound functions.
|
||||
"""
|
||||
|
||||
import copy
|
||||
import types
|
||||
import warnings
|
||||
|
||||
warnings.warn("django.utils.copycompat is deprecated; use the native copy module instead",
|
||||
PendingDeprecationWarning)
|
||||
|
||||
# Monkeypatch copy's deepcopy registry to handle functions correctly.
|
||||
if (hasattr(copy, '_deepcopy_dispatch') and types.FunctionType not in copy._deepcopy_dispatch):
|
||||
copy._deepcopy_dispatch[types.FunctionType] = copy._deepcopy_atomic
|
||||
|
||||
# Pose as the copy module now.
|
||||
del copy, types
|
||||
from copy import *
|
|
@ -0,0 +1,24 @@
|
|||
"""
|
||||
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
|
||||
|
||||
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
|
|
@ -5,6 +5,7 @@ these implementations if necessary.
|
|||
"""
|
||||
|
||||
import itertools
|
||||
import warnings
|
||||
|
||||
# Fallback for Python 2.4, Python 2.5
|
||||
def product(*args, **kwds):
|
||||
|
@ -31,3 +32,19 @@ def is_iterable(x):
|
|||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
def all(iterable):
|
||||
warnings.warn("django.utils.itercompat.all is deprecated; use the native version instead",
|
||||
PendingDeprecationWarning)
|
||||
for item in iterable:
|
||||
if not item:
|
||||
return False
|
||||
return True
|
||||
|
||||
def any(iterable):
|
||||
warnings.warn("django.utils.itercompat.any is deprecated; use the native version instead",
|
||||
PendingDeprecationWarning)
|
||||
for item in iterable:
|
||||
if item:
|
||||
return True
|
||||
return False
|
||||
|
|
|
@ -171,6 +171,14 @@ their deprecation, as per the :ref:`Django deprecation policy
|
|||
with a trailing slash to ensure there is a consistent way to
|
||||
combine paths in templates.
|
||||
|
||||
* 1.6
|
||||
|
||||
* The compatibility modules ``django.utils.copycompat`` and
|
||||
``django.utils.hashcompat`` as well as the functions
|
||||
``django.utils.itercompat.all`` and ``django.utils.itercompat.any``
|
||||
have been deprecated since the 1.4 release. The native versions
|
||||
should be used instead.
|
||||
|
||||
* 2.0
|
||||
* ``django.views.defaults.shortcut()``. This function has been moved
|
||||
to ``django.contrib.contenttypes.views.shortcut()`` as part of the
|
||||
|
|
Loading…
Reference in New Issue