Permalink
Browse files

Fix Python 3 compatibility issues

  • Loading branch information...
1 parent 07c02fe commit 588034745bce4fb3161094fac48782e7a007cb18 @anrie anrie committed Nov 20, 2013
Showing with 5 additions and 5 deletions.
  1. +1 −1 example/models.py
  2. +2 −2 image_cropping/fields.py
  3. +2 −2 image_cropping/templatetags/cropping.py
View
2 example/models.py
@@ -13,7 +13,7 @@ class Meta:
def get_cropping_as_list(self):
if self.cropping:
- return map(int, self.cropping.split(','))
+ return list(map(int, self.cropping.split(',')))
class ImageFK(models.Model):
View
4 image_cropping/fields.py
@@ -25,15 +25,15 @@ def south_field_triple(self):
class ImageRatioField(models.CharField):
def __init__(self, image_field, size='0x0', free_crop=False,
adapt_rotation=False, allow_fullsize=False, verbose_name=None,
- help_text=None, hide_image_field=False,
+ help_text=None, hide_image_field=False,
size_warning=getattr(
settings, 'IMAGE_CROPPING_SIZE_WARNING', False)):
if '__' in image_field:
self.image_field, self.image_fk_field = image_field.split('__')
else:
self.image_field, self.image_fk_field = image_field, None
- self.width, self.height = map(int, size.split('x'))
+ self.width, self.height = list(map(int, size.split('x')))
self.free_crop = free_crop
self.adapt_rotation = adapt_rotation
self.allow_fullsize = allow_fullsize
View
4 image_cropping/templatetags/cropping.py
@@ -39,7 +39,7 @@ def cropped_thumbnail(parser, token):
raise
if not 'x' in value:
raise template.TemplateSyntaxError("%s must match INTxINT" % args[3])
- option = (name, map(int, value.split('x')))
+ option = (name, list(map(int, value.split('x'))))
else:
if not option[0] in ('scale', 'width', 'height'):
raise template.TemplateSyntaxError("invalid optional argument %s" % args[3])
@@ -83,7 +83,7 @@ def render(self, context):
if not box:
size = (image.width, image.height)
else:
- box_values = map(int, box.split(','))
+ box_values = list(map(int, box.split(',')))
size = (box_values[2] - box_values[0],
box_values[3] - box_values[1])
else:

0 comments on commit 5880347

Please sign in to comment.