Replaced six.reraise with a simple raise.
This commit is contained in:
parent
a4a4b139cd
commit
7cb0cd5aff
|
@ -3,12 +3,10 @@ Utility functions for handling images.
|
||||||
|
|
||||||
Requires PIL, as you might imagine.
|
Requires PIL, as you might imagine.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import zlib
|
import zlib
|
||||||
import sys
|
|
||||||
|
|
||||||
from django.core.files import File
|
from django.core.files import File
|
||||||
from django.utils import six
|
|
||||||
|
|
||||||
class ImageFile(File):
|
class ImageFile(File):
|
||||||
"""
|
"""
|
||||||
|
@ -30,6 +28,7 @@ class ImageFile(File):
|
||||||
self._dimensions_cache = get_image_dimensions(self, close=close)
|
self._dimensions_cache = get_image_dimensions(self, close=close)
|
||||||
return self._dimensions_cache
|
return self._dimensions_cache
|
||||||
|
|
||||||
|
|
||||||
def get_image_dimensions(file_or_path, close=False):
|
def get_image_dimensions(file_or_path, close=False):
|
||||||
"""
|
"""
|
||||||
Returns the (width, height) of an image, given an open file or a path. Set
|
Returns the (width, height) of an image, given an open file or a path. Set
|
||||||
|
@ -67,7 +66,7 @@ def get_image_dimensions(file_or_path, close=False):
|
||||||
if e.args[0].startswith("Error -5"):
|
if e.args[0].startswith("Error -5"):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
six.reraise(*sys.exc_info())
|
raise
|
||||||
if p.image:
|
if p.image:
|
||||||
return p.image.size
|
return p.image.size
|
||||||
chunk_size = chunk_size*2
|
chunk_size = chunk_size*2
|
||||||
|
|
Loading…
Reference in New Issue