示例#1
0
class ISchoolYearAddForm(Interface):

    title = TextLine(title=_("Title"))

    first = Date(title=_(u"First day"))

    last = Date(title=_(u"Last day"))
    def test_date_deserializer_for_not_required_date(self):
        field = Date()
        field.required = False
        deserializer = IDeserializer(field)
        value = deserializer('None', None, None)

        self.assertEqual(None, value)
示例#3
0
class IDateRange(Interface):
    """A range of dates (inclusive).

    If r is an IDateRange, then the following invariant holds:
    r.first <= r.last

    Note that empty date ranges cannot be represented.
    """

    first = Date(
        title=u"The first day of the period of time covered.")

    last = Date(
        title=u"The last day of the period covered.")

    def __iter__():
        """Iterate over all dates in the range from the first to the last."""

    def __contains__(date):
        """Return True if the date is within the range, otherwise False.

        Raises a TypeError if date is not a datetime.date.
        """

    def __len__():
        """Return the number of dates covered by the range."""

    def overlaps(date_range):
        """Return whether this daterange overlaps with the other daterange."""

    def intersection(other_range):
        """Return intersection of date ranges (or None)."""
class ISearchForm(Interface):
    """
    Interface for creating a prenotazione
    """
    text = TextLine(
        title=_('label_text', u'Text to search'),
        default=u'',
        required=False,
    )
    review_state = Choice(title=__("State"),
                          default='',
                          required=False,
                          source='rg.prenotazioni.booking_review_states')
    gate = Choice(title=_("label_gate", u"Gate"),
                  default='',
                  required=False,
                  source='rg.prenotazioni.gates')
    start = Date(
        title=_('label_start', u'Start date '),
        description=_(" format (YYYY-MM-DD)"),
        default=None,
        required=False,
    )
    end = Date(
        title=_('label_end', u'End date'),
        description=_(" format (YYYY-MM-DD)"),
        default=None,
        required=False,
    )
示例#5
0
class IReadSchoolYear(IReadContainer, ILocation):

    title = TextLine(title=_("Title"))

    first = Date(title=_(u"The first day of the period of time covered."))

    last = Date(title=_(u"The last day of the period covered."))
class ISearchForm(Interface):
    """
    Interface for creating a prenotazione
    """

    text = TextLine(title=_("label_text", u"Text to search"),
                    default=u"",
                    required=False)
    review_state = Choice(
        title=__("State"),
        default="",
        required=False,
        source="redturtle.prenotazioni.booking_review_states",
    )
    gate = Choice(
        title=_("label_gate", u"Gate"),
        default="",
        required=False,
        source="redturtle.prenotazioni.gates",
    )
    start = Date(
        title=_("label_start", u"Start date "),
        description=_(" format (YYYY-MM-DD)"),
        default=None,
        required=False,
    )
    end = Date(
        title=_("label_end", u"End date"),
        description=_(" format (YYYY-MM-DD)"),
        default=None,
        required=False,
    )
    def test_date_deserializer_for_not_required_date(self):
        field = Date()
        field.required = False
        deserializer = IDeserializer(field)
        value = deserializer('None', None, None)

        self.assertEqual(None, value)
示例#8
0
文件: date.py 项目: mleist/ict-ok.org
 def _validate(self, value):
     """ validation method for forms """
     ## call parent validations
     ZopeDate._validate(self, value)
     if value.year > 1900:
         pass
     else:
         raise DateValidError(value, "date must be after 1900")
示例#9
0
class ITermForm(Interface):
    """Form schema for ITerm add/edit views."""

    title = TextLine(title=_("Title"))

    first = Date(title=_("Start date"))

    last = Date(title=_("End date"))
示例#10
0
class IDemoContent(Interface):

    now = Datetime(title=u"Now", readonly=True)

    startDate = Date(title=u"Start Date")
    endDate = Date(title=u"End Date")

    startDatetime = Datetime(title=u"Start Datetime")
    endDatetime = Datetime(title=u"End Datetime")

    severalDates = Set(title=u"Several dates", value_type=Date(title=u"Date"))
class IBinaryPackageReleaseDownloadCount(Interface):
    """Daily download count of a binary package release in an archive."""
    export_as_webservice_entry()

    id = Int(title=_('ID'), required=True, readonly=True)
    archive = exported(Reference(
        title=_('Archive'), schema=IArchive, required=True,
        readonly=True))
    binary_package_release = Reference(
        title=_('The binary package release'), schema=IBinaryPackageRelease,
        required=True, readonly=True)
    binary_package_name = exported(
        TextLine(
            title=_("Binary package name"),
            required=False, readonly=True))
    binary_package_version = exported(
        TextLine(
            title=_("Binary package version"),
            required=False, readonly=True))
    day = exported(
        Date(title=_('Day of the downloads'), required=True, readonly=True))
    count = exported(
        Int(title=_('Number of downloads'), required=True, readonly=True))
    country = exported(
        ReferenceChoice(
            title=_('Country'), required=False, readonly=True,
            vocabulary='CountryName', schema=ICountry))

    country_code = TextLine(
        title=_("Country code"), required=True, readonly=True,
        description=_(
            'The ISO 3166-2 country code for this count, or "unknown".'))
class IVacationBooking(Interface):
    title = TextLine(
        title=_("label_title", u"Title"),
        description=_("description_title",
                      u"This text will appear in the calendar cells"),
        default=u"",
    )
    gate = Choice(
        title=_("label_gate", u"Gate"),
        description=_("description_gate",
                      u"The gate that will be unavailable"),
        default=u"",
        vocabulary="redturtle.prenotazioni.gates",
    )
    start_date = Date(
        title=_("label_start", u"Start date "),
        description=_(" format (YYYY-MM-DD)"),
        default=None,
    )
    start_time = TextLine(
        title=_("label_start_time", u"Start time"),
        description=_("invalid_time"),
        constraint=check_time,
        default=u"00:00",
    )
    end_time = TextLine(
        title=_("label_end_time", u"End time"),
        description=_("invalid_time"),
        constraint=check_time,
        default=u"23:59",
    )
示例#13
0
class IAceVideo(IAceItem):
    """Video schema"""

    embed_url = TextLine(title=_(u"Video URL"),
                         description=u"Enter the video URL",
                         required=True)

    video_height = TextLine(
        title=_(u"Video Height"),
        description=u"Enter the video height",
        required=False,
        default=u"480",
    )

    publication_date = Date(
        title=_(u"Date of video's release"),
        description=u"The date refers to the moment in which the video has "
        u"been released. Please use the Calendar icon to add day/month/year. "
        u"If you want to add only the year, please select \"day: 1\", "
        u"\"month: January\" and then the year",
        required=True,
    )

    related_documents_presentations = RichText(
        title=_(u"Related documents and presentations"),
        required=False,
        default=None)
示例#14
0
class IVacationBooking(Interface):
    title = TextLine(
        title=_('label_title', u'Title'),
        description=_('description_title',
                      u'This text will appear in the calendar cells'),
        default=u'',
    )
    gate = Choice(
        title=_('label_gate', u'Gate'),
        description=_('description_gate',
                      u'The gate that will be unavailable'),
        default=u'',
        vocabulary='rg.prenotazioni.gates',
    )
    start_date = Date(
        title=_('label_start', u'Start date '),
        description=_(" format (YYYY-MM-DD)"),
        default=None,
    )
    start_time = TextLine(
        title=_('label_start_time', u'Start time'),
        description=_('invalid_time'),
        constraint=check_time,
        default=u'00:00',
    )
    end_time = TextLine(title=_('label_end_time', u'End time'),
                        description=_('invalid_time'),
                        constraint=check_time,
                        default=u'23:59')
示例#15
0
    def setUp(self):
        from plone.app.widgets.dx import DateWidget

        self.request = TestRequest(environ={'HTTP_ACCEPT_LANGUAGE': 'en'})
        self.field = Date(__name__='datefield')
        self.widget = DateWidget(self.request)
        self.widget.field = self.field
示例#16
0
class ITodo(form.Schema):
    """Todo schema
    """

    description = Text(title=u"Long description", required=False)

    initiator = TextLine(
        title=_(u"Initiator"),
        description=_("The user (or group) who requested this task"),
        required=False,
    )

    assignee = TextLine(
        title=_(u"Assignee"),
        description=_("A user (or a group) assigned to this task"),
        required=False,
    )

    priority = Choice(
        title=_(u"Priority"),
        required=True,
        default=-1,
        vocabulary=todo_priority,
    )

    due = Date(title=_(u"Due date"), required=False)
示例#17
0
    def setUp(self):
        from plone.app.z3cform.widget import DateWidget

        self.request = TestRequest(environ={'HTTP_ACCEPT_LANGUAGE': 'en'})
        self.field = Date(__name__='datefield')
        self.widget = DateWidget(self.request)
        self.widget.field = self.field
        self.widget.pattern_options = {'date': {'firstDay': 0}}
示例#18
0
class IMemberItem(Interface):
    """Schema for portal members """

    name = TextLine(title=u"Name", required=False, readonly=True)

    email = TextLine(title=_(u"Email Address"), required=False, readonly=True)

    last_login = Date(title=_(u"Last Login"), required=False, readonly=True)
示例#19
0
class IEventSubmissionData(form.Schema):
    """ The event submission form uses this interfaces to get the event dates
    from the user, since the default IEventBasic interface turned out to be
    too confusing for many.

    """

    submission_date_type = List(
        title=_(u'When will this event occur?'),
        required=True,
        value_type=Choice(vocabulary=SimpleVocabulary([
            SimpleTerm(value='date', title=_(u'On a single day')),
            SimpleTerm(value='range', title=_(u'On several days'))
        ])),
        default=['date'])

    submission_date = Date(title=_(u'Date'), required=False)

    submission_start_time = Time(title=_(u'Start time'), required=False)

    submission_end_time = Time(title=_(u'End time'), required=False)

    submission_range_start_date = Date(title=_(u'Start date'), required=False)

    submission_range_end_date = Date(title=_(u'End date'), required=False)

    submission_range_start_time = Time(title=_(u'Starts each day at'),
                                       required=False)

    submission_range_end_time = Time(title=_(u'Ends each day at'),
                                     required=False)

    submission_whole_day = Bool(title=_(u'All day'), required=False)

    submission_recurrence = Text(title=_(u'Recurrence'), required=False)

    submission_days = List(title=_(u'On these days'),
                           value_type=Choice(vocabulary=days),
                           required=False,
                           default=days.keys)

    form.widget('submission_recurrence',
                RecurrenceWidget,
                start_field='IEventSubmissionData.submission_date',
                first_day=first_weekday_sun0)
示例#20
0
class IReminder(Interface):
    """A Reminder object."""

    dueDate = Date(title=_(u'due date'),
                   description=_(u"due date of reminder"),
                   required=False)

    def trigger_online():
        """
class ITestForm(Interface):
    """ """
    date = Date(
        title=u'Date widget',
        required=False,
    )
    datetime = Datetime(
        title=u'DateTime widget',
        required=False,
    )
示例#22
0
class IAdaptationOption(IAceMeasure):
    """ Adaptation Option
    """

    directives.omitted(IEditForm, 'featured')
    directives.omitted(IAddForm, 'featured')

    # directives.omitted(IEditForm, 'year')
    # directives.omitted(IAddForm, 'year')

    form.widget(category="z3c.form.browser.checkbox.CheckBoxFieldWidget")
    category = List(
        title=_(u"General category"),
        description=_(u"Select one or more categories of adaptation options. "
                      u"The 3 options are:"),
        required=False,
        value_type=Choice(
            vocabulary="eea.climateadapt.aceitems_category",),
    )

    form.widget(ipcc_category="z3c.form.browser.checkbox.CheckBoxFieldWidget")
    ipcc_category = List(
        title=_(u"IPCC adaptation options categories"),
        description=_(u"Select one or more categories of adaptation options. "
                      u"The options are:"),
        required=False,
        value_type=Choice(
            vocabulary="eea.climateadapt.aceitems_ipcc_category",),
    )

    casestudies = RelationList(
        title=u"Case studies implemented in the adaption",
        default=[],
        description=_(u"Select one or more case study that this item "
                      u"relates to:"),
        value_type=RelationChoice(
            title=_(u"Related"),
            vocabulary="eea.climateadapt.case_studies"
            # source=ObjPathSourceBinder(),
            # source=CatalogSource(portal_type='eea.climateadapt.adaptionoption'),
        ),
        required=False,
    )

    publication_date = Date(
        title=_(u"Date of item's creation"),
        description=u"The date refers to the moment in which the item "
        u"has been prepared or  updated by contributing "
        u"experts to be submitted for the publication in "
        u"Climate ADAPT."
        u" Please use the Calendar icon to add day/month/year. If you want to "
        u"add only the year, please select \"day: 1\", \"month: January\" "
        u"and then the year",
        required=True
    )
示例#23
0
 class IObjectWidgetMultiSubIntegration(Interface):
     """Multi sub-integration interface"""
     multi_int = Int(title=INT_LABEL)
     multi_bool = Bool(title=BOOL_LABEL)
     multi_choice = Choice(title=CHOICE_LABEL,
                           values=('one', 'two', 'three'))
     multi_choice_opt = Choice(title=CHOICE_OPT_LABEL,
                               values=('four', 'five', 'six'),
                               required=False)
     multi_textline = TextLine(title=TEXTLINE_LABEL)
     multi_date = Date(title=DATE_LABEL)
示例#24
0
class ILibraryFileDownloadCount(Interface):
    """Download count of a given file in a given day."""

    libraryfilealias = Reference(
        title=_('The file'), schema=ILibraryFileAlias, required=True,
        readonly=True)
    day = Date(
        title=_('The day of the downloads'), required=True, readonly=True)
    count = Int(
        title=_('The number of downloads'), required=True, readonly=False)
    country = Choice(
        title=_('Country'), required=False, vocabulary='CountryName')
示例#25
0
class IBasicPerson(Interface):
    """Marker interface for a basic person."""

    prefix = TextLine(
        title=_(u"Prefix"),
        required=False,
    )

    first_name = TextLine(
        title=_(u"First name"),
        required=True,
    )

    middle_name = TextLine(
        title=_(u"Middle name"),
        required=False,
    )

    last_name = TextLine(
        title=_(u"Last name"),
        required=True,
    )

    suffix = TextLine(
        title=_(u"Suffix"),
        required=False,
    )

    preferred_name = TextLine(
        title=_(u"Preferred name"),
        required=False,
    )

    gender = Choice(
        title=_(u"Gender"),
        vocabulary=vocabulary([
            ('male', _('Male')),
            ('female', _('Female')),
        ]),
        required=False,
    )

    birth_date = Date(
        title=_(u"Birth date"),
        description=_(u"(yyyy-mm-dd)"),
        required=False,
    )

    advisors = Attribute("""Advisors of the person""")

    advisees = Attribute("""Advisees of the person""")

    levels = Attribute("""Levels of the student""")
示例#26
0
 class IObjectWidgetSingleSubIntegration(Interface):
     """Sub-integration interface"""
     single_int = Int(title=INT_LABEL)
     single_bool = Bool(title=BOOL_LABEL)
     single_choice = Choice(title=CHOICE_LABEL,
                            values=('one', 'two', 'three'))
     single_choice_opt = Choice(title=CHOICE_OPT_LABEL,
                                values=('four', 'five', 'six'),
                                required=False)
     single_textline = TextLine(title=TEXTLINE_LABEL)
     single_date = Date(title=DATE_LABEL)
     single_readonly = TextLine(title=READONLY_LABEL,
                                readonly=True)
class IQueryForm(Interface):
    """
    Interface for querying stuff
    """

    user = TextLine(title=_(u"label_user", "User"),
                    default=u"",
                    required=False)
    start = Date(
        title=_("label_start", u"Start date "),
        description=_(" format (YYYY-MM-DD)"),
        default=None,
        constraint=check_date,
        required=False,
    )
    end = Date(
        title=_("label_end", u"End date"),
        description=_(" format (YYYY-MM-DD)"),
        default=None,
        constraint=check_date,
        required=False,
    )
示例#28
0
 class IMultiWidgetDictIntegration(Interface):
     """Multi-dict interface"""
     dict_of_int = Dict(title="DictOfInt label",
                        key_type=Int(title='Int key'),
                        value_type=Int(title=INT_LABEL))
     dict_of_bool = Dict(title="DictOfBool label",
                         key_type=Bool(title='Bool key'),
                         value_type=Bool(title=BOOL_LABEL))
     dict_of_choice = Dict(title="DictOfChoice label",
                           key_type=Choice(title='Choice key',
                                           values=('key1', 'key2', 'key3')),
                           value_type=Choice(title=CHOICE_LABEL,
                                             values=('one', 'two', 'three')))
     dict_of_textline = Dict(title="DictOfTextLine label",
                             key_type=TextLine(title='TextLine key'),
                             value_type=TextLine(title=TEXTLINE_LABEL))
     dict_of_date = Dict(title="DictOfDate label",
                         key_type=Date(title='Date key'),
                         value_type=Date(title=DATE_LABEL))
     dict_of_objects = Dict(title="DictOfObject label",
                            key_type=TextLine(title='Object key'),
                            value_type=Object(title=OBJECT_LABEL,
                                              schema=IObjectWidgetMultiSubIntegration))
示例#29
0
class IJoinEvent(Interface):
    """ Information about a joining event.
    """
    userInfo = Attribute("""A userInfo instance""")
    groupInfo = Attribute("""A groupInfo instance""")
    eventDate = Date(
        title='Event Date',
        description='The joining date',
        required=True)
    addingUserInfo = Attribute("Optional: The user who added the member to the group")
    xhtml = Text(
        title='XHTML',
        description='XHTML description of event',
        required=True)
示例#30
0
class IMassEditTest(Interface):
    list_field = List(
        title='List field',
        value_type=TextLine(),
    )
    list_choice_field = List(title='List choice field',
                             value_type=Choice(vocabulary=list_field_opts, ))
    text_field = TextLine(
        title='Text field',
        required=False,
    )
    text_field_required = TextLine(title='Text field', required=True)
    date_time_field = Datetime(title='Datetime field', )
    date_field = Date(title='Date field', )
示例#31
0
 class IMultiWidgetListIntegration(Interface):
     """Multi-list interface"""
     list_of_int = List(title="ListOfInt label",
                        value_type=Int(title=INT_LABEL))
     list_of_bool = List(title="ListOfBool label",
                         value_type=Bool(title=BOOL_LABEL))
     list_of_choice = List(title="ListOfChoice label",
                           value_type=Choice(title=CHOICE_LABEL,
                                             values=('one', 'two', 'three')))
     list_of_textline = List(title="ListOfTextLine label",
                             value_type=TextLine(title=TEXTLINE_LABEL), )
     list_of_date = List(title="ListOfDate label",
                         value_type=Date(title=DATE_LABEL))
     list_of_objects = List(title="ListOfObject label",
                            value_type=Object(title=OBJECT_LABEL,
                                              schema=IObjectWidgetMultiSubIntegration))