From 35e65855680be2c8a495ec926c7eaf992c79edc0 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Sun, 20 May 2012 00:24:21 +0200 Subject: [PATCH] Imported reduce from functools for forward compatibility. In Python 3, reduce has to be imported from functools. --- django/contrib/admin/views/main.py | 1 + django/core/exceptions.py | 1 + django/utils/crypto.py | 1 + 3 files changed, 3 insertions(+) diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py index bc158da80a..85e03f3b75 100644 --- a/django/contrib/admin/views/main.py +++ b/django/contrib/admin/views/main.py @@ -1,4 +1,5 @@ import operator +from functools import reduce from django.core.exceptions import SuspiciousOperation, ImproperlyConfigured from django.core.paginator import InvalidPage diff --git a/django/core/exceptions.py b/django/core/exceptions.py index 201a854a4b..e3d1dc9c7e 100644 --- a/django/core/exceptions.py +++ b/django/core/exceptions.py @@ -1,6 +1,7 @@ """ Global Django exception and warning classes. """ +from functools import reduce class DjangoRuntimeWarning(RuntimeWarning): pass diff --git a/django/utils/crypto.py b/django/utils/crypto.py index f826c8a80c..9d6486c601 100644 --- a/django/utils/crypto.py +++ b/django/utils/crypto.py @@ -8,6 +8,7 @@ import hashlib import binascii import operator import time +from functools import reduce # Use the system PRNG if possible import random