コード例 #1
0
class IWillDoList(Interface):

    day = Date(
        title=u"Day",
        description=u"Day that I will do the items on this list",
        required=True,
    )

    closed = Bool(
        title=u"Closed",
        description=u"Is this a closed list?",
        default=False,
    )

    tasks = List(
        title=u"Task list",
        description=u"List of tasks that I will do this day",
        required=False,
        value_type=TextLine(title=u"Task"),
    )
コード例 #2
0
class ITokenInfoSchema(Interface):
    """info used to manage the token
    """

    token_id = TextLine(
                    title=_(u'label_token_value', default=u'Token Value'),
                    description=_(u'help_token_value', default=u'Value to assign to token'),
                    required=True)
    
    token_end = Datetime(
                    title=_(u'label_token_validity', default=u'Token expiration date'),
                    description=_(u'help_token_validity', default=u"From this date this token will be useless"),
                    required=True)

    token_roles= List(title=_(u'label_roles', default=u'Roles'),
                      description=_(u'help_roles', default=u"Roles to be assigned to this token's receiver"),
                      required=True,
                      default=['Reader'],
                      value_type=Choice(vocabulary='redomino.tokenrole.Roles',)
                     )
コード例 #3
0
class IExternalEventSource(form.Schema):
    """Marker for external event sources (content type)"""

    title = TextLine(title=_(u'Name'), )

    enabled = Bool(title=_(u'Enabled'), required=True, default=True)

    limit = Int(
        title=_(u'Limit'),
        description=_(u'The number of events to import every 15 minutes.'),
        required=True,
        default=25)

    autoremove = Bool(
        title=_(u'Synchronise deleted events'),
        description=_(
            u'Automatically delete already imported events if no longer '
            u'present.'),
        required=True,
        default=True)
コード例 #4
0
class IGSResponseFields(Interface):
    invitationId = ASCIILine(
        title=u'Invitation Identifier',
        description=u'The identifier for the invitation to join the '
        u'group',
        required=True)

    groupId = ASCIILine(
        title=u'Group Identifier',
        description=u'The identifier for the group to join (for the) '
        u'preview.',
        required=False)

    password1 = TextLine(
        title=u'Password',
        description=u'Your new password. You will use it to log in to '
        u'this website. This will allow you to view your private '
        u'and secret groups, post from the '
        u'web, and change your profile.',
        required=False)
コード例 #5
0
class IParentAccessForm(Interface):

    username = TextLine(
        title=_("Username"),
        description=_(u"Cannot begin with '+' or '@,' contain non-ascii characters or '/.'"),
        required=True)

    password = Password(
        title=_("Password"),
        description=_(u"Users cannot log in until a password is assigned."),
        required=False)

    confirm = Password(
        title=_("Confirm password"),
        required=False)

    @invariant
    def isPasswordConfirmed(person):
        if person.password != person.confirm:
            raise Invalid(_(u"Passwords do not match"))
コード例 #6
0
ファイル: zcml.py プロジェクト: bendavis78/zope
class IApplicationDirective(Interface):
    """Declare a WSGI application."""

    name = TextLine(title=u"Name", description=u"The name of the application")

    factory = GlobalObject(
        title=u"Application factory",
        description=(u"A factory that creates the WSGI application. "
                     u"If the application is used in the pipeline as "
                     u"middleware, the factory will be passed a single "
                     u"positional parameter containing the next "
                     u"application in the pipeline.  Other parameters "
                     u"specified for the pipeline may also be passed as "
                     u"keyword parameters."))

    for_ = Tokens(
        title=u'Request types',
        description=u'The request types that should use this application',
        value_type=GlobalObject(),
        required=False)
コード例 #7
0
class ISourcePackageAddSchema(ISourcePackageEditSchema):

    daily_build_archive = Choice(
        vocabulary='TargetPPAs',
        title=u'Daily build archive',
        required=False,
        description=(u'If built daily, this is the archive where the package '
                     u'will be uploaded.'))

    use_ppa = Choice(title=_('Which PPA'),
                     vocabulary=USE_ARCHIVE_VOCABULARY,
                     description=_("Which PPA to use..."),
                     required=True)

    ppa_name = TextLine(title=_("New PPA name"),
                        required=False,
                        constraint=name_validator,
                        description=_(
                            "A new PPA with this name will be created for "
                            "the owner of the recipe ."))
コード例 #8
0
class ISnappySeriesEditableAttributes(Interface):
    """`ISnappySeries` attributes that can be edited.

    Anyone can view these attributes, but they need launchpad.Edit to change.
    """

    name = exported(
        SnappySeriesNameField(title=_("Name"),
                              required=True,
                              readonly=False,
                              constraint=name_validator))

    display_name = exported(
        TextLine(title=_("Display name"), required=True, readonly=False))

    title = Title(title=_("Title"), required=True, readonly=True)

    status = exported(
        Choice(title=_("Status"), required=True, vocabulary=SeriesStatus))

    preferred_distro_series = exported(
        Reference(IDistroSeries,
                  title=_("Preferred distro series"),
                  required=False,
                  readonly=False))

    usable_distro_series = exported(
        List(title=_("Usable distro series"),
             description=_(
                 "The distro series that can be used for this snappy series."),
             value_type=Reference(schema=IDistroSeries),
             required=True,
             readonly=False))

    can_infer_distro_series = exported(
        Bool(title=_("Can infer distro series?"),
             required=True,
             readonly=False,
             description=_(
                 "True if inferring a distro series from snapcraft.yaml is "
                 "supported for this snappy series.")))
コード例 #9
0
ファイル: uri.py プロジェクト: l1ph0x/schooltool-2
class IURIObject(Interface):
    """An opaque identifier of a role or a relationship type.

    Roles and relationships are identified by URIs in XML representation.
    URI objects let the application assign human-readable names to roles
    and relationship types.

    URI objects are equal iff their uri attributes are equal.

    URI objects are hashable.
    """

    uri = URI(title=u"URI",
            description=u"The URI (as a string).")

    name = TextLine(title=u"Name",
            description=u"Human-readable name.")

    description = Text(title=u"Description",
            description=u"Human-readable description.")

    def persist():
        """Return persistent version of self to store in DB."""

    def __eq__(other):
        """self == other"""

    def __ne__(other):
        """self != other"""

    def __hash__():
        """Hash self (for example, return hash of uri)"""

    def access(state):
        """Access relevant portion of shared state."""

    def bind(instance, my_role, rel_type, other_role):
        """Return a relationship property bound to given instance."""

    def filter(link):
        """Default filter."""
コード例 #10
0
class IGooglevisualizationField(IBaseField):
    """
    Google chart field schema
    """
    jssettings = Text(title=u'Javascript settings',
                      description=u'Google Vizualization code',
                      default=u"""
google.load('visualization', '1', {packages: ['corechart']});
google.setOnLoadCallback(gvisudata_drawChart);
var gvisudata;

function gvisudata_drawChart() {
    gvisudata = new google.visualization.DataTable();
    gvisudata.addColumn('string', 'Category');
    gvisudata.addColumn('number', 'Volume');
    gvisudata_getCells();

    var gvisudata_chart = new google.visualization.PieChart(
        document.getElementById('gvisudata_div'));

    google.visualization.events.addListener(
        gvisudata_chart,
        'ready',
        fixGoogleCharts('gvisudata_div'));

    gvisudata_chart.draw(
        gvisudata, {
            width: 400,
            height: 400,
            is3D: true
            }
        );
}
""",
                      required=False)
    chartid = TextLine(
        title=u'Chart id',
        description=u"Used to name the javascript variable/functions "
        "and the DIV element",
        required=True,
        default=u'gvisudata')
コード例 #11
0
class IMilestoneData(IHasBugs, IStructuralSubscriptionTarget,
                     IHasOfficialBugTags):
    """Interface containing the data for milestones.

    To be registered for views but not instantiated.
    """
    id = Int(title=_("Id"))

    name = exported(
        MilestoneNameField(
            title=_("Name"),
            description=_(
                "Only letters, numbers, and simple punctuation are allowed."),
            constraint=name_validator))
    target = exported(
        Reference(
            schema=Interface,  # IHasMilestones
            title=_("The product, distribution, or project group for this "
                    "milestone."),
            required=False))
    dateexpected = exported(FormattableDate(
        title=_("Date Targeted"),
        required=False,
        description=_("Example: 2005-11-24")),
                            exported_as='date_targeted')
    active = exported(Bool(title=_("Active"),
                           description=_(
                               "Whether or not this object should be shown "
                               "in web forms for targeting.")),
                      exported_as='is_active')
    displayname = Attribute("A displayname constructed from the name.")
    title = exported(
        TextLine(title=_("A context title for pages."), readonly=True))
    all_specifications = doNotSnapshot(
        Attribute('All specifications linked to this milestone.'))

    def bugtasks(user):
        """Get a list of non-conjoined bugtasks visible to this user."""

    def getSpecifications(user):
        """Return the specifications visible to this user."""
コード例 #12
0
class IGoogleDrive(IOAuth2Settings):

    scope = List(title=u"Scope",
                 required=False,
                 default=[u'https://www.googleapis.com/auth/drive'],
                 value_type=TextLine())

    authorization_url = URI(
        title=u"Authorization url",
        description=u"Url to start user authorization",
        default="https://accounts.google.com/o/oauth2/auth",
        required=False,
    )

    token_url = URI(
        title=u"Token url",
        description=u"Url to token service",
        default="https://accounts.google.com/o/oauth2/token",
        required=False,
    )

    refresh_url = URI(
        title=u"Refresh url",
        description=u"Url to token refresh service",
        default="https://accounts.google.com/o/oauth2/token",
        required=False,
    )

    redirect_url = URI(
        title=u"Redirect url",
        description=u"Url to redirect to after successful authorization",
        required=False,
    )

    revoke_url = URI(
        title=u"Revoke url",
        description=u"Url to revoke authorization",
        # Google OAuth2 would also have programmatic web endpoint to revoke access
        default="https://security.google.com/settings/security/permissions",
        required=False,
    )
コード例 #13
0
class IParametersSchema(Interface):
    oshmail_subscribers = TextLine(
        title=_(u"Number of OSHMail Subscribers"),
        description=_(u"Number of subscribers of the OSHMail newsletter."),
        required=False)

    show_atoz_link = Bool(
        title=_(u"Show A-Z link in search portlet"),
        description=_(
            u"With this option you can turn off showing the link to 'A-Z Index "
            "in the search portlet"),
        required=False,
        default=True)

    show_previous_events = Bool(
        title=_(u"Show previous events"),
        description=_(
            u"With this option you can turn off the links to previous events "
            "in the calendar and events portlets"),
        required=False,
        default=True)
コード例 #14
0
class IResourceDirectoryDirective(Interface):
    """Register resource directories with the global registry.
    """

    directory = TextLine(title=u'Directory path',
                         description=u'Path relative to the package.',
                         required=True)

    name = PythonIdentifier(
        title=u'Name',
        description=u'Name of the directory. If not specified, the name of '
        u'the current package is used.',
        required=False,
    )

    type = ASCIILine(
        title=u'Resource type',
        # XXX use a Choice field + vocab
        #        vocabulary = 'plone.resource.vocab.ResourceTypes',
        required=False,
    )
コード例 #15
0
class IGSCoreProfile(Interface):
    """Schema use to defile the core profile of a GroupServer user."""

    fn = TextLine(
        title=u'Name',
        description=u'The name that you want others to see on your profile '
        u'and posts.',
        required=True,
        min_length=1,
        constraint=display_name_not_nul)

    tz = Choice(title=u'Timezone',
                description=u'The timezone you wish to use',
                required=False,
                default=u'UTC',
                vocabulary=SimpleVocabulary.fromValues(pytz.common_timezones))

    biography = Text(title=u'Biography',
                     description=u'A desciption of you.',
                     required=False,
                     default=u'')
コード例 #16
0
class IEDemProfileAdminJoinSingle(IEDemProfileAdminBasic):
    message = Text(
        title=u'Invitation Message',
        description=u'The message that appears at the top of the email '
        u'invitation to the new group member. The message will '
        u'appear before the link that allows the member to accept '
        u'or reject the invitation.',
        required=True)

    fromAddr = Choice(
        title=u'Email From',
        description=u'The email address that you want in the "From" '
        u'line in the invitation that you send.',
        vocabulary='EmailAddressesForLoggedInUser',
        required=True)

    subject = TextLine(
        title=u'Subject',
        description=u'The subject line of the invitation message that '
        u'will be sent to the new member',
        required=True)
コード例 #17
0
ファイル: bugtracker.py プロジェクト: pombredanne/launchpad-3
class IRemoteBug(Interface):
    """A remote bug for a given bug tracker."""

    bugtracker = Choice(title=_('Bug System'),
                        required=True,
                        vocabulary='BugTracker',
                        description=_("The bug tracker in which "
                                      "the remote bug is found."))

    remotebug = StrippedTextLine(title=_('Remote Bug'),
                                 required=True,
                                 readonly=False,
                                 description=_(
                                     "The bug number of this bug in the "
                                     "remote bug system."))

    bugs = Attribute(
        _("A list of the Launchpad bugs watching the remote bug."))

    title = TextLine(title=_('Title'),
                     description=_('A descriptive label for this remote bug'))
コード例 #18
0
class IResourceDirectoryDirective(IBasicResourceInformation):
    """
    Defines a directory containing browser resources.

    .. seealso:: `.DirectoryResource`
    """

    name = TextLine(title=u"The name of the resource",
                    description=u"""
        This is the name used in resource urls. Resource urls are of
        the form ``<site>/@@/resourcename``, where ``<site>`` is the url of
        "site", a folder with a site manager.

        We make resource urls site-relative (as opposed to
        content-relative) so as not to defeat caches.""",
                    required=True)

    directory = Path(
        title=u"Directory",
        description=u"The directory containing the resource data.",
        required=True)
コード例 #19
0
    def test_select(self):
        from plone.app.widgets.dx import SelectWidget
        request = TestRequest(environ={'HTTP_ACCEPT_LANGUAGE': 'en'},
                              example='example-value')
        widget = SelectWidget(request)
        widget.name = 'example'
        widget.field = TextLine(__name__='selectfield')
        widget.field.vocabulary = SimpleVocabulary.fromValues(
            ['option1', 'option2', 'option3'])
        self.assertEqual(
            widget._widget_args(),
            {
                'name': 'example',
                'pattern': 'select2',
                'pattern_options': {},
                'options': [('option1', None),
                            ('option2', None),
                            ('option3', None)],

            },
        )
コード例 #20
0
class INaayaSimpleViewDirective(Interface):
    """ Define a simple zope3 view """
    for_ = GlobalInterface(
        title=u"The interface this view is for.",
        required=True,
    )
    name = TextLine(
        title=u"The name of the view.",
        description=u"The name shows up in URLs/paths. For example 'foo'.",
        required=True,
    )
    handler = GlobalObject(
        title=_("Handler"),
        description=_("Function that handles the view."),
        required=True,
    )
    permission = Permission(
        title=u"Permission",
        description=u"The permission needed to use the view.",
        required=False,
    )
コード例 #21
0
def setupBasicFieldRequestAndMembers(portal):
    """Some test setup for the member widget tests, creat a few members,
       return a Tuple based field, and a fake request"""
    field = Tuple(__name__='foo',
                  title=u'Foo',
                  value_type=TextLine(title=u'member'))
    request = TestRequest(form={})
    field.context = portal  #bind the field to the portal
    portal.portal_membership.addMember('test1',
                                       'secret', ('Member', ), (),
                                       properties={
                                           'fullname': 'Test User 1',
                                           'email': '*****@*****.**'
                                       })
    portal.portal_membership.addMember('test2',
                                       'secret', ('Member', ), (),
                                       properties={
                                           'fullname': 'Test User 2',
                                           'email': '*****@*****.**'
                                       })
    return field, request
コード例 #22
0
class IBugMessage(IHasBug):
    """A link between a bug and a message."""

    bug = Object(schema=IBug, title=u"The bug.")
    # The index field is being populated in the DB; once complete it will be
    # made required. Whether to make it readonly or not is dependent on UI
    # considerations. If, once populated, it becomes read-write, we probably
    # want to ensure that only actions like bug import or spam hiding can
    # change it, rather than arbitrary API scripts.
    index = Int(title=u'The comment number', required=False, readonly=False,
        default=None)
    messageID = Int(title=u"The message id.", readonly=True)
    message = Object(schema=IMessage, title=u"The message.")
    bugwatch = Object(schema=IBugWatch,
        title=u"A bugwatch to which the message pertains.")
    bugwatchID = Int(title=u'The bugwatch id.', readonly=True)
    remote_comment_id = TextLine(
        title=u"The id this comment has in the bugwatch's bug tracker.")
    ownerID = Attribute("The ID of the owner mirrored from the message")
    owner = Object(schema=IPerson,
        title=u"The Message owner mirrored from the message.", readonly=True)
コード例 #23
0
class ITraverserPluginBase(Interface):

    for_ = GlobalObject(
        title=u"The interface this plugin is for.",
        required=True,
    )

    layer = GlobalObject(
        title=u"The layer the plugin is declared for",
        required=False,
    )

    name = TextLine(
        title=u"The name the traverser will be traversing into.",
        required=False,
    )

    permission = Permission(
        title=u"Permission",
        required=False,
    )
コード例 #24
0
ファイル: interfaces.py プロジェクト: Py-AMS/pyams-zfiles
class IDocumentContainer(IBTreeContainer):
    """Document container utility interface"""

    contains(IDocumentFolder)

    oid_prefix = TextLine(
        title=_("Documents OID prefix"),
        description=_("Prefix used to identify documents which were "
                      "created locally (unlike documents which were created "
                      "into another documents container and synchronized with "
                      "this container)"),
        required=False)

    def add_document(self, data, properties, request):
        """Add new document"""

    def import_document(self, oid, data, properties, request):
        """Import document from outer ZFiles database"""

    def find_documents(self, params, request=None):
        """Find documents matching given params"""

    def get_document(self, oid, version=None):
        """Retrieve existing document from it's OID

        If no version number is specified, the last version
        is returned.
        """

    # pylint: disable=too-many-arguments
    def update_document(self,
                        oid,
                        version=None,
                        data=None,
                        properties=None,
                        request=None):
        """Update document data or properties"""

    def delete_document(self, oid):
        """Delete document or version"""
コード例 #25
0
ファイル: likes.py プロジェクト: affinitic/sc.social.like
class IFbSchema(Interface):
    """ Facebook configurations """

    fb_enabled = Bool(
        title=_(u"Enable Facebook button"),
        default=True,
        required=False,
    )

    fb_typebutton = Choice(
        title=_(u"Choose the type of button you want"),
        required=True,
        default=u'like',
        vocabulary=buttonTypes,
    )

    fbaction = Choice(
        title=_(u'Verb to display'),
        description=_(
            u'help_verb_display',
            default=u"The verb to display in the facebook button. "
            u"Currently only 'like' and 'recommend' are "
            u"supported."
            u"Only used for 'Like' button type.",
        ),
        required=True,
        default=u'like',
        vocabulary=verbs,
    )

    fbadmins = TextLine(
        title=_(u'Admins'),
        description=_(
            u'help_admins',
            default=u"A comma-separated list of either the "
            u"Facebook IDs of page administrators or a "
            u"Facebook Platform application ID.",
        ),
        required=False,
    )
コード例 #26
0
class ILayerDirective(Interface):
    """ *BBB: DEPRECATED*

    Creating layers via ZCML has been deprecated.  The
    'browser:layer' directive will be removed in Zope 3.5.  Layers
    are now interfaces extending
    'zope.publisher.interfaces.browser.IBrowserRequest'.
    They do not need further registration.

    **Previous documentation**

    Defines a browser layer

    You must either specify a `name` or an `interface`. If you specify the
    name, then a layer interface will be created for you based on the name and
    the `base` interface.

    If you specify the `name` and the `interface`, then the layer will be
    registered twice for the name. This way we can be backward compatible. 
    The layer is still available via its dotted name.

    If you do not specify a `base`, then `IBrowserRequest` is used by default.

    You cannot specify both, the `interface` and the `base` attribute.
    """

    name = TextLine(title=u"Name",
                    description=u"The name of the layer.",
                    required=False)

    interface = GlobalInterface(title=u"The layer's interface.",
                                required=False)

    base = GlobalObject(title=u"Name",
                        description=u"The name of the skin",
                        required=False)

    bbb_aware = Bool(title=u"BBB-aware",
                     description=u"Backward-compatability aware?",
                     required=False)
コード例 #27
0
class ICodeReviewVoteReferencePublic(Interface):
    """The public attributes for code review vote references."""

    id = Int(title=_("The ID of the vote reference"))

    branch_merge_proposal = exported(
        Reference(
            title=_("The merge proposal that is the subject of this vote"),
            required=True,
            schema=IBranchMergeProposal))

    date_created = exported(
        Datetime(title=_('Date Created'), required=True, readonly=True))

    registrant = exported(
        PublicPersonChoice(
            title=_("The person who originally registered this vote"),
            required=True,
            vocabulary='ValidPersonOrTeam'))

    reviewer = exported(
        PersonChoice(title=_('Reviewer'),
                     required=True,
                     description=_('A person who you want to review this.'),
                     vocabulary='ValidBranchReviewer'))

    review_type = exported(
        TextLine(title=_('Review type'),
                 required=False,
                 description=_(
                     "Lowercase keywords describing the type of review.")))

    comment = exported(
        Reference(title=_(
            "The code review comment that contains the most recent vote."),
                  required=True,
                  schema=ICodeReviewComment))

    is_pending = exported(
        Bool(title=_("Is the pending?"), required=True, readonly=True))
コード例 #28
0
class IDevice(Interface):
    """A device object."""

    cpuType = TextLine(title=_(u'CPU type'),
                       description=_(u'Text of CPU type'),
                       required=False)

    memsize = Int(title=_(u'Memory size (MB)'),
                  description=_(u'Memory size in MB'),
                  required=False)

    interfaces = List(
        title=_(u"Interface"),
        value_type=Choice(vocabulary='AllUnusedOrUsedDeviceInterfaces'),
        required=False,
        default=[])

    osoftwares = List(
        title=_(u"Operating software"),
        value_type=Choice(
            vocabulary='AllUnusedOrUsedDeviceOperatingSoftwares'),
        required=False,
        default=[])

    appsoftwares = List(
        title=_(u"Application software"),
        value_type=Choice(
            vocabulary='AllUnusedOrUsedDeviceApplicationSoftwares'),
        required=False,
        default=[])

    logicalDevices = List(title=_(u"Logical Devices"),
                          value_type=Choice(vocabulary='AllLogicalDevices'),
                          required=False,
                          default=[])

    physicalMedia = List(title=_(u"Physical Media"),
                         value_type=Choice(vocabulary='AllPhysicalMedia'),
                         required=False,
                         default=[])
コード例 #29
0
ファイル: interfaces.py プロジェクト: mleist/ict-ok.org
class IAddress(Interface):
    """A Address object."""

    address1 = TextLine(
        title = _(u'Address1'),
        description = _(u"Address line 1"),
        required = False)
        
    address2 = TextLine(
        title = _(u'Address2'),
        description = _(u"Address line 2"),
        required = False)
        
    address3 = TextLine(
        title = _(u'Address3'),
        description = _(u"Address line 3"),
        required = False)
        
    city = TextLine(
        title = _(u'City'),
        description = _(u"City"),
        required = False)
        
    postalCode = TextLine(
        title = _(u'Postal code'),
        description = _(u"Postal code"),
        required = False)
        
    country = TextLine(
        title = _(u'Country'),
        description = _(u"Country"),
        required = False)
        

#    contactItem = Choice(
#        title = _(u'Contact item'),
#        vocabulary = 'AllContactItems',
#        required = False)
#    
    contactItems = List(
        title = _(u'Contact items'),
        value_type=Choice(vocabulary='AllContactItems'),
        default=[],
        required = False)
        
    def trigger_online():
        """
コード例 #30
0
ファイル: jalonconfig.py プロジェクト: suipnice/Jalon
class IJalonConfigExterneControlPanel(Interface):
    """fields for jalon Config Externe control panel."""

    activer_externes = Bool(
        title=_(u"Activer la section Ressources externes dans mon espace."),
        description=
        _(u"Cocher pour activer la section Ressources externes dans mon espace."
          ),
        default=False,
        required=False)
    externes = List(
        title=_(u"Externes : définition des étiquettes par défaut."),
        description=_(u"Exemple : les types de ressources externes"),
        value_type=TextLine(),
        default=[],
        required=False)
    activer_cataloguebu = Bool(
        title=_(u"Activer la section Catalogue BU dans mon espace."),
        description=_(
            u"Cocher pour activer la section Catalogue BU dans mon espace."),
        default=False,
        required=False)