Skip to content

Commit

Permalink
add comment to get_images_view and merged exception handlings
Browse files Browse the repository at this point in the history
  • Loading branch information
cekk authored and hvelarde committed Nov 4, 2014
1 parent 4c21e4c commit 2cff795
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sc/social/like/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def get_images_view(context):
field = [f for f in schema.keys() if f in fields]
if field:
field = field[0]
# if a content has an image field that isn't an ImageField
# (for example a relation field), set field="" to avoid errors
if schema[field].type not in ["image", "blob"]:
field = ""
value = (view, field) if (view and field) else (None, None)
Expand Down Expand Up @@ -55,9 +57,7 @@ def get_content_image(context,
kwargs['direction'] = 'down'
try:
img = view.scale(fieldname=field, **kwargs)
except AttributeError:
img = None
except TypeError:
except (AttributeError, TypeError):
img = None
cache[key] = img
return img
Expand Down

0 comments on commit 2cff795

Please sign in to comment.