Example #1
0
def _validate_image(image_file, width, height):
    try:
        image_file.seek(0)
        image = Image.open(image_file)
        w = image.size[0]
        h = image.size[1]
        if w != width or h != height:
            return _(u'Invalid size. Please upload %sx%s image' % (width,
                height))
    except:
        # had issue with validation of size, ignore.. probably should do
        # something here
        pass

    return True
 def title(self):
     return _('WCC Slider Portlet')
Example #3
0
from collective.grok import gs
from wcc.carousel import MessageFactory as _

@gs.importstep(
    name=u'wcc.carousel', 
    title=_('wcc.carousel import handler'),
    description=_(''))
def setupVarious(context):
    if context.readDataFile('wcc.carousel.marker.txt') is None:
        return
    portal = context.getSite()

    # do anything here