summaryrefslogtreecommitdiffstats
path: root/imagekit
diff options
context:
space:
mode:
Diffstat (limited to 'imagekit')
-rw-r--r--imagekit/management/commands/ikflush.py4
-rw-r--r--imagekit/models.py9
-rw-r--r--imagekit/options.py2
-rw-r--r--imagekit/specs.py2
-rw-r--r--imagekit/tests.py2
5 files changed, 9 insertions, 10 deletions
diff --git a/imagekit/management/commands/ikflush.py b/imagekit/management/commands/ikflush.py
index c03440f..0af60c4 100644
--- a/imagekit/management/commands/ikflush.py
+++ b/imagekit/management/commands/ikflush.py
@@ -20,9 +20,9 @@ def flush_cache(apps, options):
"""
apps = [a.strip(',') for a in apps]
if apps:
- print 'Flushing cache for %s...' % ', '.join(apps)
+ print('Flushing cache for %s...' % ', '.join(apps))
else:
- print 'Flushing caches...'
+ print('Flushing caches...')
for app_label in apps:
app = cache.get_app(app_label)
diff --git a/imagekit/models.py b/imagekit/models.py
index 140715e..0eba0ab 100644
--- a/imagekit/models.py
+++ b/imagekit/models.py
@@ -47,7 +47,7 @@ class ImageModelBase(ModelBase):
except ImportError:
raise ImportError('Unable to load imagekit config module: %s' % \
opts.spec_module)
- for spec in [spec for spec in module.__dict__.values() \
+ for spec in [spec for spec in list(module.__dict__.values()) \
if isinstance(spec, type) \
and issubclass(spec, specs.ImageSpec) \
and spec != specs.ImageSpec]:
@@ -56,7 +56,7 @@ class ImageModelBase(ModelBase):
setattr(cls, '_ik', opts)
-class ImageModel(models.Model):
+class ImageModel(models.Model, metaclass=ImageModelBase):
""" Abstract base class implementing all core ImageKit functionality
Subclasses of ImageModel are augmented with accessors for each defined
@@ -64,7 +64,6 @@ class ImageModel(models.Model):
storage locations and other options.
"""
- __metaclass__ = ImageModelBase
class Meta:
abstract = True
@@ -81,10 +80,10 @@ class ImageModel(models.Model):
self._ik.admin_thumbnail_spec
else:
if hasattr(self, 'get_absolute_url'):
- return u'<a href="%s"><img src="%s"></a>' % \
+ return '<a href="%s"><img src="%s"></a>' % \
(self.get_absolute_url(), prop.url)
else:
- return u'<a href="%s"><img src="%s"></a>' % \
+ return '<a href="%s"><img src="%s"></a>' % \
(self._imgfield.url, prop.url)
admin_thumbnail_view.short_description = _('Thumbnail')
admin_thumbnail_view.allow_tags = True
diff --git a/imagekit/options.py b/imagekit/options.py
index 022cc9e..71883e0 100644
--- a/imagekit/options.py
+++ b/imagekit/options.py
@@ -18,6 +18,6 @@ class Options(object):
spec_module = 'imagekit.defaults'
def __init__(self, opts):
- for key, value in opts.__dict__.iteritems():
+ for key, value in opts.__dict__.items():
setattr(self, key, value)
self.specs = [] \ No newline at end of file
diff --git a/imagekit/specs.py b/imagekit/specs.py
index a6832ba..4b991dd 100644
--- a/imagekit/specs.py
+++ b/imagekit/specs.py
@@ -6,7 +6,7 @@ spec found.
"""
import os
-from StringIO import StringIO
+from io import StringIO
from imagekit.lib import *
from imagekit.utils import img_to_fobj
from django.core.files.base import ContentFile
diff --git a/imagekit/tests.py b/imagekit/tests.py
index 8c2eb5e..c44f66d 100644
--- a/imagekit/tests.py
+++ b/imagekit/tests.py
@@ -83,4 +83,4 @@ class IKTest(TestCase):
# make sure image file is deleted
path = self.p.image.path
self.p.delete()
- self.failIf(os.path.isfile(path))
+ self.assertFalse(os.path.isfile(path))