How to use the zope.schema.Int function in Zope

To help you get started, we’ve selected a few Zope examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github collective / wildcard.media / wildcard / media / behavior.py View on Github external
u"If video was uploaded to youtube, this field will be filled "
                      u"with video url."),
        required=False
    )

    @invariant
    def validate_videos(data):
        if not data.video_file and not data.youtube_url:
            raise Invalid("Must specify either a video file or youtube url")

    width = schema.Int(
        title=_(u"Width"),
        defaultFactory=getDefaultWidth
    )

    height = schema.Int(
        title=_(u"Height"),
        defaultFactory=getDefaultHeight
    )

    subtitle_file = namedfile.NamedBlobFile(
        title=_(u"Subtitle file"),
        description=_(u"Provide a file in srt format"),
        required=False
    )

    form.omitted('metadata')
    metadata = schema.Text(
        required=False
    )

    transcript = RichText(
github collective / collective.nitf / src / collective / nitf / controlpanel.py View on Github external
description=_(u"help_title_max_chars",
                      default=u"The optimal value is going to be the range between this value and the max"),
        default=140,
        required=False,
    )

    show_description_counter = schema.Bool(
        title=_(u"label_show_description_counter",
                default=u"Show Description characters counter"),
        description=_(u"help_show_description_counter",
                      default=u"If selected, the description is going to provide a character counter"),
        required=False,
        default=False,
    )

    description_max_chars = schema.Int(
        title=_(u"label_description_max_chars",
                default=u"Max number of characters acepted by the description"),
        description=_(u"help_description_max_chars",
                      default=u"This limit is just visual, does not enforce validation"),
        default=140,
        required=False,
    )

    description_optimal_chars = schema.Int(
        title=_(u"label_description_optimal_chars",
                default=u"Optimal number of characters for the nitf description"),
        description=_(u"help_description_max_chars",
                      default=u"The optimal value is going to be the range between this value and the max"),
        default=140,
        required=False,
    )
github collective / collective.easyslider / collective / easyslider / portlets / slider.py View on Github external
It inherits from IPortletDataProvider because for this portlet, the
    data that is being rendered and the portlet assignment itself are the
    same.
    """

    over = schema.Text(
        title=_(u"Over"),
        description=_(u"The cover text. You might want an image here."),
        required=True)

    under = schema.Text(
        title=_(u"Under"),
        description=_(u"The text you'll see when a user hovers."),
        required=True)

    height = schema.Int(
        title=_(u"Height"),
        description=_(u"Required since it is difficult to know the height "
                      u"when using two different over and under elements."),
        required=True,
        default=200
    )

    hide = schema.Bool(
        title=_(u"Hide portlet"),
        description=_(u"Tick this box if you want to temporarily hide "
                      "the portlet without losing your text."),
        required=True,
        default=False)


class Assignment(base.Assignment):
github plone / plone.app.portlets / plone / app / portlets / portlets / rss.py View on Github external
    @property
    def siteurl(self):
        """return the link to the site the RSS feed points to"""
        return self._siteurl


class IRSSPortlet(IPortletDataProvider):

    portlet_title = schema.TextLine(
        title=_(u'Title'),
        description=_(u'Title of the portlet.  If omitted, the title of the '
                      u'feed will be used.'),
        required=False,
        default=u'')

    count = schema.Int(
        title=_(u'Number of items to display'),
        description=_(u'How many items to list.'),
        required=True,
        default=5)

    url = schema.TextLine(
        title=_(u'URL of RSS feed'),
        description=_(u'Link of the RSS feed to display.'),
        required=True,
        default=u'')

    timeout = schema.Int(
        title=_(u'Feed reload timeout'),
        description=_(u'Time in minutes after which the feed should be '
                      u'reloaded.'),
        required=True,
github zopefoundation / z3c.form / src / z3c / form / browser / interfaces.py View on Github external
required=False)


class IHTMLImageWidget(IHTMLInputWidget):
    """A widget using the HTML INPUT element with type 'image'."""

    src = zope.schema.TextLine(
        title=u'Image Source',
        description=(u'The source of the image used to display the widget.'),
        required=True)


class IHTMLTextInputWidget(IHTMLFormElement):
    """A widget using the HTML INPUT element (for text types)."""

    size = zope.schema.Int(
        title=u'Size',
        description=(u'This attribute tells the user agent the initial width '
                     u'of the control -- in this case in characters.'),
        required=False)

    maxlength = zope.schema.Int(
        title=u'Maximum Length',
        description=(u'This attribute specifies the maximum number of '
                     u'characters the user may enter.'),
        required=False)

    placeholder = zope.schema.TextLine(
        title=u'Placeholder Text',
        description=(u'This attribute represents a short hint '
                     u'(a word or short phrase) intended to aid the user '
                     u'with data entry when the control has no value.'),
github plone / guillotina / src / plone.server / plone / server / interfaces.py View on Github external
)

    output_mime_type = schema.ASCIILine(
        title=_(u"Default output MIME type"),
        default='text/x-html-safe'
    )

    allowed_mime_types = schema.Tuple(
        title=_(u"Allowed MIME types"),
        description=_(u"Set to None to disable checking"),
        default=None,
        required=False,
        value_type=schema.ASCIILine(title=u"MIME type"),
    )

    max_length = schema.Int(
        title=_(u'Maximum length'),
        description=_(u'in characters'),
        required=False,
        min=0,
        default=None,
    )


class IRichTextValue(Interface):
    """The value actually stored in a RichText field.
    This stores the following values on the parent object
      - A separate persistent object with the original value
      - A cache of the value transformed to the default output type
    The object is immutable.
    """
github collective / collective.upload / src / collective / upload / interfaces.py View on Github external
u'If selected, the upload widget will be shown in the context of '
            u'the folder contents view also. The widget will be always '
            u'accessible via the "Add new…" menu regardless this value.'),
        default=True,
    )

    upload_extensions = schema.TextLine(
        title=_(u'Allowed Extensions'),
        description=_(
            u'allowed_extensions_key',
            default=u'List the file extensions allowed for upload, without dots and separated by "|"'),
        required=False,
        default=config.UPLOAD_EXTENSIONS,
    )

    max_file_size = schema.Int(
        title=_(u'Max file size'),
        description=_(
            u'max_file_size_key',
            default=u'The maximum allowed file size in bytes. Please note that '
                    u'intermediate web servers may put limits on this value; '
                    u'ask your Systems Administrator in case of doubt.'),
        required=False,
        default=config.MAX_FILE_SIZE,
    )

    resize_max_width = schema.Int(
        title=_(u'maximum width'),
        description=_(
            u'resize_max_width_key',
            default=u'The maximum width for uploaded images.'),
        required=False,
github castlecms / castle.cms / castle / cms / tiles / existing.py View on Github external
default=(
            'title',
            'image',
            'description'
        ),
        value_type=schema.Choice(
            vocabulary=SimpleVocabulary([
                SimpleTerm('title', 'title', u'Title'),
                SimpleTerm('image', 'image', u'Image'),
                SimpleTerm('description', 'description', u'Overview/Summary'),
                SimpleTerm('date', 'date', u'Date'),
            ])
        )
    )

    truncate_count = schema.Int(
        title=u'Overview/Summary Truncate',
        description=u'Number of words to truncate the overview/summary to',
        required=False,
        default=18
    )

    image_display_type = schema.Choice(
        title=u'Image display type',
        description=u'Does not apply to all display types',
        required=True,
        default=defaults.get('existing_tile_image_displaytype', u'landscape'),
        vocabulary=SimpleVocabulary([
            SimpleTerm('landscape', 'landscape', u'Landscape'),
            SimpleTerm('portrait', 'portrait', u'Portrait'),
            SimpleTerm('square', 'square', u'Square')
        ])
github ggozad / collective.classification / src / collective / classification / browser / samplecontent.py View on Github external
from zope.schema.vocabulary import SimpleVocabulary
from zope import schema
from zope.interface import Interface
from nltk.corpus import brown
from zope.formlib import form
from Products.Five.formlib import formbase
from Products.CMFCore.utils import getToolByName

brownCategories = SimpleVocabulary.fromValues(brown.categories())

class ISampleContent(Interface):
    no_items = schema.Int(
        title=u"Number of documents per category to import",
        required=True,
        max = 20
    )

    brown_categories = schema.List(
        title=u"Brown corpus categories to import",
        value_type=schema.Choice(vocabulary = brownCategories),
        required=True
    )

class SampleContentView(formbase.PageForm):
    """Imports content from the brown corpus for testing.
    """

    form_fields = form.Fields(ISampleContent)
github plone / Products.CMFPlone / Products / CMFPlone / interfaces / controlpanel.py View on Github external
max=95,
        default=88
    )

    highpixeldensity_scales = schema.Choice(
        title=_(u'High pixel density mode'),
        description=_(u''),
        default='disabled',
        vocabulary=SimpleVocabulary([
            SimpleTerm('disabled', 'disabled', u'Disabled'),
            SimpleTerm('2x', '2x', u'Enabled (2x)'),
            SimpleTerm('3x', '3x', u'Enabled (2x, 3x)')
        ]),
    )

    quality_2x = schema.Int(
        title=_(u'Image quality at 2x'),
        description=_(u'A value for the quality of 2x high pixel density images, from 1 '
                      '(lowest) to 95 (highest). A value of 0 will mean '
                      'plone.scaling\'s default will be used, which is '
                      'currently 62.'),
        min=0,
        max=95,
        default=62,
    )

    quality_3x = schema.Int(
        title=_(u'Image quality at 3x'),
        description=_(u'A value for the quality of 3x high pixel density images, from 1 '
                      '(lowest) to 95 (highest). A value of 0 will mean '
                      'plone.scaling\'s default will be used, which is '
                      'currently 51.'),