1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Removed a bunch more Python 2.4 workarounds now that we don't support that version. Refs #15702 -- thanks to jonash for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15927 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty
2011-03-28 02:11:19 +00:00
parent a87be3554f
commit 13864703bc
56 changed files with 113 additions and 326 deletions

View File

@@ -3,6 +3,7 @@
# Unit tests for cache framework
# Uses whatever cache backend is set in the test settings file.
import hashlib
import os
import tempfile
import time
@@ -19,7 +20,6 @@ from django.test.utils import get_warnings_state, restore_warnings_state
from django.utils import translation
from django.utils import unittest
from django.utils.cache import patch_vary_headers, get_cache_key, learn_cache_key
from django.utils.hashcompat import md5_constructor
from django.views.decorators.cache import cache_page
from regressiontests.cache.models import Poll, expensive_calculation
@@ -850,7 +850,7 @@ class FileBasedCacheTests(unittest.TestCase, BaseCacheTests):
"""Test that keys are hashed into subdirectories correctly"""
self.cache.set("foo", "bar")
key = self.cache.make_key("foo")
keyhash = md5_constructor(key).hexdigest()
keyhash = hashlib.md5(key).hexdigest()
keypath = os.path.join(self.dirname, keyhash[:2], keyhash[2:4], keyhash[4:])
self.assertTrue(os.path.exists(keypath))
@@ -860,7 +860,7 @@ class FileBasedCacheTests(unittest.TestCase, BaseCacheTests):
"""
self.cache.set("foo", "bar")
key = self.cache.make_key("foo")
keyhash = md5_constructor(key).hexdigest()
keyhash = hashlib.md5(key).hexdigest()
keypath = os.path.join(self.dirname, keyhash[:2], keyhash[2:4], keyhash[4:])
self.assertTrue(os.path.exists(keypath))