Skip to content

Commit

Permalink
#130 - fix rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
claytonc.sousa@gmail.com authored and claytonc.sousa@gmail.com committed Sep 18, 2017
1 parent 22a0d83 commit 0f4ad5f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sc/social/like/upgrades/v3047/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# coding=utf-8
# -*- coding:utf-8 -*-
29 changes: 29 additions & 0 deletions sc/social/like/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# -*- coding:utf-8 -*-
from Acquisition import aq_base
from plone import api
from plone.formwidget.namedfile.converter import b64decode_file
# from plone.namedfile.file import NamedBlobImage
from Products.Archetypes.interfaces import IBaseContent
from Products.CMFPlone.utils import safe_hasattr
from sc.social.like import LikeMessageFactory as _
Expand Down Expand Up @@ -198,3 +201,29 @@ def validate_og_lead_image(image):
raise ValueError(MSG_INVALID_OG_LEAD_IMAGE_ASPECT_RATIO)

return True


def get_fallback_image():
from sc.social.like.interfaces import ISocialLikeSettings

fallback_image = api.portal.get_registry_record('fallback_image', interface=ISocialLikeSettings)
if fallback_image:
filename, data = b64decode_file(fallback_image)
return '/@@sociallike-fallback-image/' + filename
else:
return '/logo.png'


# def validate_image_settings(value):
# """Check image fallback be in formats mime type, dimensions and size."""
#
# if not value:
# return True
#
# filename, data = b64decode_file(value)
# image = NamedBlobImage(data=data, filename=filename)
# msg = validate_image_social(image)
#
# if msg:
# raise Invalid(msg)
# return True

0 comments on commit 0f4ad5f

Please sign in to comment.