Python 3
[wolnelektury.git] / src / picture / templatetags / picture_tags.py
index 02d80b0..973d862 100644 (file)
@@ -18,6 +18,7 @@ register = template.Library()
 
 cropper = CustomCroppingEngine()
 
+
 @register.inclusion_tag('picture/picture_wide.html', takes_context=True)
 def picture_wide(context, picture):
     context.update({
@@ -54,7 +55,9 @@ def area_thumbnail_url(area, geometry):
             area.picture.image_file,
             geometry,
             crop="%dpx %dpx %dpx %dpx" % tuple(map(lambda d: max(0, d), tuple(coords[0] + coords[1]))))
-    except Exception, e:
+    except ZeroDivisionError:
+        return ''
+    except Exception as e:
         logging.exception("Error creating a thumbnail for PictureArea")
         return ''