Skip to content

Commit

Permalink
Merge pull request #33 from collective/fix-image-miniature
Browse files Browse the repository at this point in the history
Fix image miniature generation
  • Loading branch information
hvelarde committed Nov 4, 2014
2 parents 3fcc64d + 2cff795 commit 04ddb7a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ Changelog

- Fixed metadata og:type, used value 'article' for internal page [fdelia]

- If a field named "image" isn't an ImageField, do not break the viewlet
[cekk]

- Add exception handling also for TypeError in get_content_image method
[cekk]


2.0rc1 (2014-10-14)
^^^^^^^^^^^^^^^^^^
Expand Down
6 changes: 5 additions & 1 deletion sc/social/like/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ 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)
cache[key] = value
return value
Expand Down Expand Up @@ -53,7 +57,7 @@ def get_content_image(context,
kwargs['direction'] = 'down'
try:
img = view.scale(fieldname=field, **kwargs)
except AttributeError:
except (AttributeError, TypeError):
img = None
cache[key] = img
return img
Expand Down

0 comments on commit 04ddb7a

Please sign in to comment.