mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #14749 -- added support for using Django's file object as context managers. Thanks to Florian Apolloner for the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14671 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -4,8 +4,17 @@ import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
from cStringIO import StringIO
|
||||
from datetime import datetime, timedelta
|
||||
try:
|
||||
from cStringIO import StringIO
|
||||
except ImportError:
|
||||
from StringIO import StringIO
|
||||
|
||||
try:
|
||||
import threading
|
||||
except ImportError:
|
||||
import dummy_threading as threading
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import SuspiciousOperation
|
||||
from django.core.files.base import ContentFile, File
|
||||
@@ -15,11 +24,6 @@ from django.core.files.uploadedfile import UploadedFile
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.utils import unittest
|
||||
|
||||
try:
|
||||
import threading
|
||||
except ImportError:
|
||||
import dummy_threading as threading
|
||||
|
||||
# Try to import PIL in either of the two ways it can end up installed.
|
||||
# Checking for the existence of Image is enough for CPython, but
|
||||
# for PyPy, you need to check for the underlying modules
|
||||
@@ -31,6 +35,7 @@ except ImportError:
|
||||
except ImportError:
|
||||
Image = None
|
||||
|
||||
|
||||
class GetStorageClassTests(unittest.TestCase):
|
||||
def assertRaisesErrorWithMessage(self, error, message, callable,
|
||||
*args, **kwargs):
|
||||
@@ -430,6 +435,7 @@ class InconsistentGetImageDimensionsBug(unittest.TestCase):
|
||||
Multiple calls of get_image_dimensions() should return the same size.
|
||||
"""
|
||||
from django.core.files.images import ImageFile
|
||||
|
||||
img_path = os.path.join(os.path.dirname(__file__), "test.png")
|
||||
image = ImageFile(open(img_path, 'rb'))
|
||||
image_pil = Image.open(img_path)
|
||||
|
||||
Reference in New Issue
Block a user