# BBB Backward compatible.
        # XXX This should be removed in Products.EEAContentTypes > 2.25
        if isinstance(img, ZODBImage):
            return ImageField.getScale(self, instance, scale, **kwargs)

        return super(ImageBlobField,
                     self).getScale(instance, scale, **kwargs)

enable_exception = zconf.swallowImageResizeExceptions.enable

schema = public.Schema((

    ImageBlobField('image',
                   required=False,
                   storage=public.AnnotationStorage(migrate=True),
                   languageIndependent=True,
                   allowable_content_types=('image/gif', 'image/jpeg',
                                            'image/jpg', 'image/png',
                                            'image/tiff'),
                   swallowResizeExceptions=enable_exception,
                   pil_quality=zconf.pil_config.quality,
                   pil_resize_algo=zconf.pil_config.resize_algo,
                   max_size=(1280, 1024),
                   sizes={'xlarge': (633, 356),
                          'wide': (325, 183),
                          'large': (768, 768),
                          'preview': (400, 400),
                          'mini': (180, 135),
                          'thumb': (128, 128),
                          'tile': (64, 64),
Exemplo n.º 2
0
assert False, "Please complete your script"
"""

MiPagoAdapterSchema = formMailerAdapterSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-
    atapi.StringField('mipago_cpr_code',
                      languageIndependent=True,
                      vocabulary=atapi.DisplayList([
                          ('9050299', _(u'9050299: Notebook 60, modality 1')),
                          ('9052180', _(u'9052180: Notebook 60, modality 2')),
                          ('9050794', _(u'9050794: Notebook 57')),
                      ]),
                      required=True,
                      storage=atapi.AnnotationStorage(),
                      searchable=False,
                      widget=atapi.SelectionWidget(
                          description='',
                          label=_('Enter the CPR code of this payment'),
                          size=7)),
    atapi.StringField(
        'mipago_format',
        languageIndependent=True,
        vocabulary=atapi.DisplayList([
            ('502', _(u'502: Notebook 60, modality 1, short format')),
            ('521', _(u'521: Notebook 60, modality 2, short format')),
            ('522', _(u'522: Notebook 60, modality 2, long format')),
            ('507', _(u'507: Notebook 57, short format')),
        ]),
        required=True,
Exemplo n.º 3
0
from Products.ATContentTypes.configuration import zconf
from Products.ATContentTypes.content import schemata
from Products.ATContentTypes.content import folder
from Products.ATContentTypes import ATCTMessageFactory as _at

from raptus.article.core.interfaces import IArticle
from raptus.article.core.config import PROJECTNAME
from raptus.article.core import RaptusArticleMessageFactory as _

ArticleSchema = folder.ATFolderSchema.copy() + atapi.Schema((
    atapi.TextField(
        'text',
        primary=True,
        required=False,
        searchable=True,
        storage=atapi.AnnotationStorage(),
        validators=('isTidyHtmlWithCleanup', ),
        default_output_type='text/x-html-safe',
        widget=atapi.RichWidget(
            description='',
            label=_at(u'label_body_text', default=u'Body Text'),
            rows=25,
            allow_file_upload=zconf.ATDocument.allow_document_upload),
    ),
    atapi.BooleanField(
        'hideTitle',
        required=False,
        languageIndependent=True,
        default=False,
        storage=atapi.AnnotationStorage(),
        schemata='settings',
except ImportError:
    from Products.Archetypes import atapi
from Products.ATContentTypes.content import link
from Products.ATContentTypes.content import schemata
from Products.ATContentTypes.configuration import zconf
from Products.validation import V_REQUIRED

from Products.Carousel import CarouselMessageFactory as _
from Products.Carousel.interfaces import ICarouselBanner
from Products.Carousel.config import PROJECTNAME

CarouselBannerSchema = link.ATLinkSchema.copy() + atapi.Schema((
    atapi.ImageField(
        'image',
        required=False,
        storage=atapi.AnnotationStorage(),
        languageIndependent=True,
        max_size=zconf.ATNewsItem.max_image_dimension,
        sizes={},
        validators=(('isNonEmptyFile', V_REQUIRED),
                    ('checkNewsImageMaxSize', V_REQUIRED)),
        widget=atapi.ImageWidget(description=_(
            'This image will be shown when this banner is active.'),
                                 label=_('Image'),
                                 show_content_type=False)),
    atapi.StringField('imageUrl',
                      required=False,
                      searchable=False,
                      default="http://",
                      widget=atapi.StringWidget(description=_(
                          'Instead of uploading an image, you may enter'