Exemplo n.º 1
0
 def test_get_widgets_for_schema_fields(self):
     salutation = Choice(title=u'Salutation', values=("Mr.", "Mrs.", "Captain", "Don"))
     contactname = TextLine(title=u'Name')
     request = FakeRequest()
     salutation = salutation.bind(request)
     contactname = contactname.bind(request)
     view1 = getViewProviding(contactname, IInputWidget, request)
     self.assertEquals(view1.__class__, zope.app.form.browser.textwidgets.TextWidget)
     view2 = getViewProviding(salutation, IInputWidget, request)
     self.assertEquals(view2.__class__, zope.app.form.browser.itemswidgets.DropdownWidget)
Exemplo n.º 2
0
    def _validate(self, specurl):
        TextLine._validate(self, specurl)
        if (ISpecification.providedBy(self.context) and
            specurl == self.context.specurl):
            # The specurl wasn't changed
            return

        specification = getUtility(ISpecificationSet).getByURL(specurl)
        if specification is not None:
            specification_url = canonical_url(specification)
            raise LaunchpadValidationError(
                    structured(self.errormessage, specurl, specification_url,
                        specification.title))
Exemplo n.º 3
0
class IHostVMwareEsx(IHost):
    """A host object."""
    # TODO move to own Interface towards admin_util.esx...
    esxUuid = TextLine(max_length=80,
                       title=_("ESX UUID"),
                       description=_("UUID of virtual machine in ESX."),
                       default=u"",
                       required=False)

    def shutdownHost(self):
        """
        trigger shutdownHost
        """

    def enterMaintenanceMode(self):
        """
Exemplo n.º 4
0
class IBreadcrumbInfo(Interface):
    """Provides pieces of information about a breadcrumb."""

    name = TextLine(title=u'Name',
                    description=u'The name of the breadcrumb.',
                    required=True)

    url = URI(title=u'URL',
              description=u'The url of the breadcrumb.',
              required=True)

    active = Bool(
        title=u'Active',
        description=u'Tells whether the breadcrumb link should active.',
        required=True,
        default=True)
class ISourcePackageName(Interface):
    """Interface provied by a SourcePackageName.

    This is a tiny table that allows multiple SourcePackage entities to share
    a single name.
    """
    id = Int(title=_("ID"), required=True)
    name = TextLine(title=_("Valid Source package name"),
                    required=True,
                    constraint=name_validator)
    potemplates = Attribute("The list of PO templates that this object has.")
    packagings = Attribute("Everything we know about the packaging of "
                           "packages with this source package name.")

    def __unicode__():
        """Return the name"""
Exemplo n.º 6
0
class IRatingCategoryInfo(Interface):
    """Describes the schema of a ratings category"""
    name = TextLine(
        title=_(u"Category Id"),
        description=_(u"Unique Id for this rating category"),
        required=False,
        default=u'',
        readonly=True,
    )

    title = TextLine(
        title=_(u"Title"),
        description=_(u"The displayed title of this ratings category, "
                      u"keep this concise"),
        required=True,
    )

    description = TextLine(
        title=_(u"Description"),
        description=_("The description of the category for display in the "
                      "user interface."),
        default=u'',
        required=False,
    )

    # This will eventually be a Choice field,
    # with a vocabulary of views
    view_name = TextLine(
        title=_(u"View"),
        description=_(u"Select the view for this category"),
        default=u'rating_view',
        required=False,
    )

    read_expr = TextLine(
        title=_(u"Read Expression"),
        description=_(u"A TALES expression used to determine whether viewing "
                      u"the rating is allowed.  Leave blank to always allow."),
        required=False,
    )

    write_expr = TextLine(
        title=_(u"Write Expression"),
        description=_(u"A TALES expression used to determine whether setting "
                      u"the rating is allowed.  Leave blank to always allow."),
        required=False,
    )

    order = Int(
        title=_(u"Order"),
        description=_("The relative order in which the category should "
                      "appear."),
        required=False,
        default=100,
    )
Exemplo n.º 7
0
class IExpressionTypeDirective(Interface):
    """Register a new TALES expression type"""

    name = TextLine(
        title=u"Name",
        description=u"""Name of the expression. This will also be used
        as the prefix in actual TALES expressions.""",
        required=True
        )

    handler = GlobalObject(
        title=u"Handler",
        description=u"""Handler is class that implements
        zope.tales.interfaces.ITALESExpression.""",
        required=True
        )
Exemplo n.º 8
0
class IPDFOptions(Interface):
    """Misg global options for PDF rendering
    """

    disallowed_types = Tuple(
        title=_(u'label_disallowed_types', default=u"Discarded content types"),
        description=_(
            u'help_disallowed_types',
            default=u"Select content types that will not be rendered"),
        value_type=Choice(
            vocabulary="plone.app.vocabularies.ReallyUserFriendlyTypes"))

    recode_path = ASCIILine(
        title=_(u'label_recode_path', default=u"\"recode\" executable"),
        description=_(
            u'help_recode_path',
            default=(
                u"The full absolute path to the \"recode\". executable"
                u"On Unix \"which recode\" should provide the good value.")),
        default="/usr/bin/recode")

    htmldoc_path = ASCIILine(
        title=_(u'label_htmldoc_path', default=u"\"htmldoc\" executable"),
        description=_(
            u'help_htmldoc_path',
            default=(
                u"The full absolute path to the \"htmldoc\" executable. "
                u"On Unix \"which htmldoc\" should provide the good value")),
        default="/usr/bin/htmldoc")

    htmldoc_options = Text(
        title=_(u'htmldoc_options', default=u"Options for htmldoc"),
        description=_(
            u'help_htmldoc_options',
            default=
            (u"See the htmldoc documentation <http://www.htmldoc.org/documentation.php/toc.html>."
             u" but do not add the \"-f\" option here.")),
        required=False)

    pdfbook_logo = TextLine(
        title=_(u"Logo path"),
        description=_(
            u'help_pdfbook_logo',
            default=
            (u"The path of the logo if you need to include a logo in your headers (can be a path relative to the document, can be a view or a script)."
             )),
        required=False)
Exemplo n.º 9
0
class ISourcePackageRecipeEditableAttributes(IHasOwner):
    """ISourcePackageRecipe attributes that can be edited.

    These attributes need launchpad.View to see, and launchpad.Edit to change.
    """
    daily_build_archive = exported(
        Reference(IArchive, title=_("The archive to use for daily builds.")))

    builder_recipe = Attribute(
        _("The bzr-builder data structure for the recipe."))

    owner = exported(
        PersonChoice(
            title=_('Owner'),
            required=True,
            readonly=False,
            vocabulary='UserTeamsParticipationPlusSelf',
            description=_("The person or team who can edit this recipe.")))

    distroseries = exported(
        List(ReferenceChoice(schema=IDistroSeries,
                             vocabulary='BuildableDistroSeries'),
             title=_("Default distribution series"),
             description=_("If built daily, these are the distribution "
                           "versions that the recipe will be built for."),
             readonly=True))
    build_daily = exported(
        Bool(title=_("Built daily"),
             description=_(
                 "Automatically build each day, if the source has changed.")))

    name = exported(
        TextLine(title=_("Name"),
                 required=True,
                 constraint=name_validator,
                 description=_(
                     "The name of the recipe is part of the URL and needs to "
                     "be unique for the given owner.")))

    description = exported(
        Description(title=_('Description'),
                    required=False,
                    description=_('A short description of the recipe.')))

    date_last_modified = exported(Datetime(required=True, readonly=True))

    is_stale = Bool(title=_('Recipe is stale.'))
Exemplo n.º 10
0
class ISiteSchema(Interface):

    site_title = TextLine(title=_(u'Site title'),
                          description=_(u"This shows up in the title bar of "
                                        "browsers and in syndication feeds."),
                          default=u'')

    site_description = Text(title=_(u'Site description'),
                            description=_(
                                u"The site description is available "
                                "in syndicated content and in search engines. "
                                "Keep it brief."),
                            default=u'',
                            required=False)

    exposeDCMetaTags = Bool(
        title=_(u"Expose Dublin Core metadata"),
        description=_(u"Exposes the Dublin Core properties as metatags."),
        default=False,
        required=False)

    display_pub_date_in_byline = Bool(
        title=_(u"Display publication date in 'about' information"),
        description=_(u"Displays content publication date on site pages."),
        default=False,
        required=False)

    enable_sitemap = Bool(title=_(u"Expose sitemap.xml.gz"),
                          description=_(
                              u"Exposes your content as a file "
                              "according to the sitemaps.org standard. You "
                              "can submit this to compliant search engines "
                              "like Google, Yahoo and Microsoft. It allows "
                              "these search engines to more intelligently "
                              "crawl your site."),
                          default=False,
                          required=False)

    webstats_js = SourceText(
        title=_(u'JavaScript for web statistics support'),
        description=_(u"For enabling web statistics support "
                      "from external providers (for e.g. Google "
                      "Analytics). Paste the code snippets provided. "
                      "It will be included in the rendered HTML as "
                      "entered near the end of the page."),
        default=u'',
        required=False)
Exemplo n.º 11
0
class IBehaviorDirective(Interface):
    """Directive which registers a new behavior type.

    The registration consists of:

        * a global named utility registered by interface identifier
        * a global named utility registered by lookup name
        * an associated global and unnamed behavior adapter
    """

    name = TextLine(title=u"Name",
                    description=u"Convenience lookup name for this behavior",
                    required=False)

    title = configuration_fields.MessageID(
        title=u"Title",
        description=u"A user friendly title for this behavior",
        required=True)

    description = configuration_fields.MessageID(
        title=u"Description",
        description=u"A longer description for this behavior",
        required=False)

    provides = configuration_fields.GlobalInterface(
        title=u"An interface to which the behavior can be adapted",
        description=u"This is what the conditional adapter factory will "
        u"be registered as providing",
        required=True)

    marker = configuration_fields.GlobalInterface(
        title=u"A marker interface to be applied by the behavior",
        description=u"If factory is not given, then this is optional",
        required=False)

    factory = configuration_fields.GlobalObject(
        title=u"The factory for this behavior",
        description=u"If this is not given, the behavior is assumed to "
        u"provide a marker interface",
        required=False)

    for_ = configuration_fields.GlobalObject(
        title=u"The type of object to register the conditional adapter "
        u"factory for",
        description=u"This is optional - the default is to register the "
        u"factory for zope.interface.Interface",
        required=False)
Exemplo n.º 12
0
class IID(Interface):

    id = TextLine(title=_(u'ID'), )

    ratio_width = Float(
        title=_(u'Ratio Width'),
        description=_(
            u'Keep this field 0.0 if you do not need to set width/height ratio.'
        ),
        default=0.0,
    )

    ratio_height = Float(
        title=_(u'Ratio Height'),
        description=_(
            u'Keep this field 0.0 if you do not need to set width/height ratio.'
        ),
        default=0.0,
    )

    min_width = Float(
        title=_(u'Minimum Width'),
        description=_(
            u'Keep this field 0.0 if you do not need to set minimum width.'),
        default=0.0,
    )

    min_height = Float(
        title=_(u'Minimum Height'),
        description=_(
            u'Keep this field 0.0 if you do not need to set minimum height.'),
        default=0.0,
    )

    max_width = Float(
        title=_(u'Maximum Width'),
        description=_(
            u'Keep this field 0.0 if you do not need to set maximum width.'),
        default=0.0,
    )

    max_height = Float(
        title=_(u'Maximum Height'),
        description=_(
            u'Keep this field 0.0 if you do not need to set maximum height.'),
        default=0.0,
    )
Exemplo n.º 13
0
class CreateNewForm(form.AddForm):
    # A subform used to add new OAuth provider configurations
    # It is a basic AddForm that ignores the context

    fields = field.Fields(
        Choice(__name__='provider',
               title=u'Provider',
               values=('OAuth 2', 'OAuth 1')),
        TextLine(__name__='name', required=False, title=u'Name'),
    )

    def create(self, data):
        # TODO: check errors
        registry = getUtility(IRegistry)
        coll = None
        rec = None
        if data.get('provider') == 'OAuth 1':
            coll = registry.collectionOfInterface(IOAuth1Settings)
        elif data.get('provider') == 'OAuth 2':
            coll = registry.collectionOfInterface(IOAuth2Settings)
        if coll is not None:
            normalizer = getUtility(IIDNormalizer)
            # is new id an str object or unicode?
            newid = normalizer.normalize(data.get('name'))
            rec = coll.add(newid)
            rec.id = newid
            rec.title = data.get('name')
        return rec

    def add(self, obj):
        # create already did the add
        # TODO: if obj is None we probably have a problem somewhere
        self._finishedAdd = True

    def render(self):
        # Override render so that we can set our own http status in case
        # of redirect
        # TODO: add some confirmation message somehow?
        #       IStatusMessage for succes
        #       and maybe self.errorMessage as error?
        # can't use 201 as browsers won't do the redirect on a 2xx code
        # 302 / 307 (307 is more specific) might do as  well
        if self._finishedAdd:
            self.request.response.redirect(self.nextURL(), 303)
            # shortcut content ceration
            return ""
        return super(CreateNewForm, self).render()
Exemplo n.º 14
0
    def test_usererror(self):
        self.field = Tuple(__name__=u'foo',
                           value_type=TextLine(__name__='bar'))
        request = TestRequest(
            form={
                'field.foo.0.bar': u'',
                'field.foo.1.bar': u'nonempty',
                'field.foo.count': u'2'
            })
        widget = TupleSequenceWidget(self.field, self.field.value_type,
                                     request)
        s = widget()
        # Rendering a widget should not raise errors!
        result = widget()

        data = widget._generateSequence()
        self.assertEquals(data, [None, u'nonempty'])
Exemplo n.º 15
0
class IAddBugTaskWithProductCreationForm(ILinkPackaging):

    bug_url = StrippedTextLine(
        title=_('Bug URL'),
        required=True,
        constraint=valid_remote_bug_url,
        description=_("The URL of this bug in the remote bug tracker."))
    display_name = TextLine(title=_('Project name'))
    name = ProductNameField(
        title=_('Project ID'),
        constraint=name_validator,
        required=True,
        description=_(
            "A short name starting with a lowercase letter or number, "
            "followed by letters, dots, hyphens or plusses. e.g. firefox, "
            "linux, gnome-terminal."))
    summary = Summary(title=_('Project summary'), required=True)
Exemplo n.º 16
0
class IStaticSubscriptionDirective(Interface):
    """
    Define a global, static, transient subscription.

    Static subscriptions are not persistent and live only in the
    memory of individual processes. Thus, failed deliveries cannot be
    re-attempted after process shutdown. And of course the delivery history
    is also transient and local to a process.
    """

    for_ = GlobalObject(
        title=IWebhookSubscription['for_'].title,
        description=IWebhookSubscription['for_'].description,
        default=IWebhookSubscription['for_'].default,
        required=False,
    )

    when = ObjectEventInterface(
        title=IWebhookSubscription['when'].title,
        description=IWebhookSubscription['when'].description,
        default=IWebhookSubscription['when'].default,
        required=False,
    )

    to = IWebhookSubscription['to'].bind(None)

    dialect = TextLine(
        # We can't use the field directly because it wants to validate
        # against a Choice using a vocabulary based on registered utilities.
        # That doesn't work as an argument if we're still registering those
        # utilities.
        title=IWebhookSubscription['dialect_id'].title,
        description=IWebhookSubscription['dialect_id'].description,
        default=IWebhookSubscription['dialect_id'].default,
        required=False)

    owner = IWebhookSubscription['owner_id'].bind(None)

    permission = Permission(title=u"The permission to check",
                            description=u"""
        If given, and an *owner* is also specified, then only data that
        has this permission for the *owner* will result in an attempted delivery.
        If not given, but an *owner* is given, this will default to the standard
        view permission ID, ``zope.View``.
        """,
                            required=False)
Exemplo n.º 17
0
    def test_converter_RelationChoice(self):
        from plone.app.widgets.dx import \
            RelationChoiceRelatedItemsWidgetConverter
        brain = Mock(getObject=Mock(return_value='obj'))
        portal_catalog = Mock(return_value=[brain])
        widget = Mock()
        converter = RelationChoiceRelatedItemsWidgetConverter(
            TextLine(), widget)

        with mock.patch('plone.app.widgets.dx.IUUID', return_value='id'):
            self.assertEqual(converter.toWidgetValue('obj'), 'id')
        self.assertEqual(converter.toWidgetValue(None), None)

        with mock.patch('plone.app.widgets.dx.getToolByName',
                        return_value=portal_catalog):
            self.assertEqual(converter.toFieldValue('id'), 'obj')
        self.assertEqual(converter.toFieldValue(None), None)
Exemplo n.º 18
0
class ITranslationDomain(Interface):
    """The Translation Domain utility

    This interface provides methods for translating text, including text with
    interpolation.

    When we refer to text here, we mean text that follows the standard Zope 3
    text representation.

    The domain is used to specify which translation to use.  Different
    products will often use a specific domain naming translations supplied
    with the product.

    A favorite example is: How do you translate 'Sun'? Is it our star, the
    abbreviation of Sunday or the company?  Specifying the domain, such as
    'Stars' or 'DaysOfWeek' will solve this problem for us.

    Standard arguments in the methods described below:

        msgid -- The id of the message that should be translated.  This may be
                 an implicit or an explicit message id.

        mapping -- The object to get the interpolation data from.

        target_language -- The language to translate to.

        context -- An object that provides contextual information for
                   determining client language preferences.  It must implement
                   or have an adapter that implements IUserPreferredLanguages.
                   It will be to determine the language to translate to if
                   target_language is not specified explicitly.

        Also note that language tags are defined by RFC 1766.
    """

    domain = TextLine(
        title=u"Domain Name",
        description=u"The name of the domain this object represents.",
        required=True)

    def translate(msgid,
                  mapping=None,
                  context=None,
                  target_language=None,
                  default=None):
        """Return the translation for the message referred to by msgid.
Exemplo n.º 19
0
class ITwitterSchema(Interface):
    """ Twitter configurations """

    twitter_enabled = Bool(
        title=_(u"Enable Twitter button"),
        default=True,
        required=False,
    )

    twittvia = TextLine(
        title=_(u'Twitter nick'),
        description=_(
            u'help_your_twitter_nick',
            default=u"Enter your twitter nick. eg. simplesconsultoria",
        ),
        required=False,
    )
Exemplo n.º 20
0
class IFAQ(IHasOwner):
    """A document containing the answer to a commonly asked question.

    The answer can be in the document itself or can be hosted on a separate
    web site and referred to by URL.
    """

    id = Int(
        title=_('FAQ Number'),
        description=_('The unique number identifying the FAQ in Launchpad.'),
        required=True, readonly=True)

    title = Title(
        title=_('Title'),
        description=_('The title describing this FAQ, often a question.'),
        required=True)

    keywords = TextLine(
        title=_('Keywords'),
        description=_('One or more terms that relate to this FAQ.'),
        required=False)

    content = Text(
        title=_('Content'),
        description=_(
            'The answer for this FAQ in plain text. You may choose to '
            'include a URL to an external FAQ.'),
        required=True)

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

    last_updated_by = PublicPersonChoice(
        title=_('Last Updated By'),
        description=_('The last person who modified the document.'),
        vocabulary='ValidPersonOrTeam', required=False)

    date_last_updated = Datetime(title=_('Last Updated'), required=False)

    target = Object(
        title=_('Target'),
        description=_('Product or distribution containing this FAQ.'),
        schema=IFAQTarget,
        required=True)

    related_questions = Attribute(
        _('The set of questions linked to this FAQ.'))
    def test_subwidget(self):
        """This test verifies that the specified subwidget is not ignored.
        (Issue #293)
        """
        self.field = List(__name__=u'foo',
                          value_type=TextLine(__name__=u'bar'))
        request = TestRequest()

        class PollOption(object):
            pass

        ow = CustomWidgetFactory(ObjectWidget, PollOption)
        widget = SequenceWidget(self.field,
                                self.field.value_type,
                                request,
                                subwidget=ow)
        assert widget.subwidget is ow
Exemplo n.º 22
0
class IProductReviewSearch(Interface):
    """A search form for products being reviewed."""

    search_text = TextLine(
      title=_('Search text'),
      description=_("Search text in the product's name, displayname, title, "
                    "summary, and description."),
      required=False)

    active = Choice(
        title=_('Active'), values=[True, False],
        required=False, default=True)

    project_reviewed = Choice(
        title=_('Project Reviewed'), values=[True, False],
        required=False, default=False)

    license_approved = Choice(
        title=_('Project Approved'), values=[True, False],
        required=False, default=False)

    licenses = Set(
        title=_('Licenses'),
        value_type=Choice(vocabulary=License),
        required=False,
        default=set())

    has_subscription = Choice(
        title=_('Has Commercial Subscription'),
        values=[True, False], required=False)

    created_after = Date(title=_("Created between"), required=False)

    created_before = Date(title=_("and"), required=False)

    subscription_expires_after = Date(
        title=_("Subscription expires between"), required=False)

    subscription_expires_before = Date(
        title=_("and"), required=False)

    subscription_modified_after = Date(
        title=_("Subscription modified between"), required=False)

    subscription_modified_before = Date(
        title=_("and"), required=False)
Exemplo n.º 23
0
class IViewDirective(IPagesDirective):
    """
    The view directive defines a view that has subpages.

    The pages provided by the defined view are accessed by first
    traversing to the view name and then traversing to the page name.
    """

    for_ = GlobalInterface(title=u"The interface this view is for.",
                           required=False)

    name = TextLine(
        title=u"The name of the view.",
        description=u"The name shows up in URLs/paths. For example 'foo'.",
        required=False,
        default=u'',
    )

    menu = MenuField(title=u"The browser menu to include the page (view) in.",
                     description=u"""
          Many views are included in menus. It's convenient to name
          the menu in the page directive, rather than having to give a
          separate menuItem directive.  'zmi_views' is the menu most often
          used in the Zope management interface.

          This attribute will only work if zope.browsermenu is installed.
          """,
                     required=False)

    title = MessageID(title=u"The browser menu label for the page (view)",
                      description=u"""
          This attribute must be supplied if a menu attribute is
          supplied.

          This attribute will only work if zope.browsermenu is installed.
          """,
                      required=False)

    provides = GlobalInterface(
        title=u"The interface this view provides.",
        description=u"""
        A view can provide an interface.  This would be used for
        views that support other views.""",
        required=False,
        default=Interface,
    )
Exemplo n.º 24
0
class IPasswordwallSchema(ISecuritySchema):
    """Schema for passwordwall settings."""

    passwordwall = Bool(
        title=u'Site behind password',
        description=u"Users must enter credentials to view the site, "
        u"even Anonymous users",
        default=False,
        required=False,
    )

    password = TextLine(
        title=u'Site password',
        description=u"Users must enter this password to view the site. ",
        default=u'',
        required=False,
    )
Exemplo n.º 25
0
class IPublishingEdit(Interface):
    """Base interface for writeable Publishing classes."""

    def requestDeletion(removed_by, removal_comment=None):
        """Delete this publication.

        :param removed_by: `IPerson` responsible for the removal.
        :param removal_comment: optional text describing the removal reason.
        """

    @call_with(removed_by=REQUEST_USER)
    @operation_parameters(
        removal_comment=TextLine(title=_("Removal comment"), required=False))
    @export_operation_as("requestDeletion")
    @export_write_operation()
    def api_requestDeletion(removed_by, removal_comment=None):
        """Delete this source and its binaries.
Exemplo n.º 26
0
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'))
Exemplo n.º 27
0
class ILocaleInheritance(Interface):
    """Locale inheritance support.

    Locale-related objects implementing this interface are able to ask for its
    inherited self. For example, 'en_US.dates.monthNames' can call on itself
    'getInheritedSelf()' and get the value for 'en.dates.monthNames'. 
    """

    __parent__ = Attribute("The parent in the location hierarchy")

    __name__ = TextLine(
        title=u"The name within the parent",
        description=u"""The parent can be traversed with this name to get
                      the object.""")

    def getInheritedSelf():
        """Return itself but in the next higher up Locale."""
Exemplo n.º 28
0
class IDistroArchSeriesModerate(Interface):
    @operation_parameters(data=Bytes(),
                          sha1sum=Text(),
                          pocket=Choice(vocabulary=PackagePublishingPocket,
                                        required=False),
                          image_type=Choice(vocabulary=BuildBaseImageType,
                                            required=False))
    @export_write_operation()
    @operation_for_version("devel")
    def setChroot(data, sha1sum, pocket=None, image_type=None):
        """Set the chroot tarball used for builds in this architecture.

        The SHA-1 checksum must match the chroot file.

        The pocket defaults to "Release"; the image type defaults to "Chroot
        tarball".
        """

    @operation_parameters(
        # Really ILiveFSBuild, patched in _schema_circular_imports.py.
        livefsbuild=Reference(Interface,
                              title=_("Live filesystem build"),
                              required=True),
        filename=TextLine(title=_("Filename"), required=True),
        pocket=Choice(vocabulary=PackagePublishingPocket, required=False),
        image_type=Choice(vocabulary=BuildBaseImageType, required=False))
    @export_write_operation()
    @operation_for_version("devel")
    def setChrootFromBuild(livefsbuild,
                           filename,
                           pocket=None,
                           image_type=None):
        """Set the chroot tarball from a live filesystem build.

        The pocket defaults to "Release"; the image type defaults to "Chroot
        tarball".
        """

    @operation_parameters(pocket=Choice(vocabulary=PackagePublishingPocket,
                                        required=False),
                          image_type=Choice(vocabulary=BuildBaseImageType,
                                            required=False))
    @export_write_operation()
    @operation_for_version("devel")
    def removeChroot(pocket=None, image_type=None):
        """Remove the chroot tarball used for builds in this architecture.
Exemplo n.º 29
0
class IGlobalLinuxHaUtility(Interface):
    """
    IGlobalLinuxHaUtility
    """
    lastLinuxHa = TextLine(
        min_length = 5,
        max_length = 40,
        title = _("Last LinuxHa Contact"),
        description = _("Date of last VmWare-Esx Vim contact"),
        default = _("00.00.0000"),
        required = True)
    
    def getUtilityVersion(self):
        """ global und svn Version of Utility """
        
    def getUptime(self):
        """uptime of Utility"""
Exemplo n.º 30
0
class IDistroSeriesEditRestricted(Interface):
    """IDistroSeries properties which require launchpad.Edit."""
    @rename_parameters_as(dateexpected='date_targeted')
    @export_factory_operation(IMilestone,
                              ['name', 'dateexpected', 'summary', 'code_name'])
    def newMilestone(name, dateexpected=None, summary=None, code_name=None):
        """Create a new milestone for this DistroSeries."""

    @operation_parameters(
        parents=List(title=_("The list of parents to derive from."),
                     value_type=TextLine(),
                     required=True),
        architectures=List(title=_(
            "The list of architectures to copy to the derived "
            "distroseries."),
                           value_type=TextLine(),
                           required=False),
        archindep_archtag=TextLine(title=_(
            "Architecture tag to build architecture-independent "
            "packages."),
                                   required=False),
        packagesets=List(title=_(
            "The list of packagesets to copy to the derived "
            "distroseries"),
                         value_type=TextLine(),
                         required=False),
        rebuild=Bool(title=_("If binaries will be copied to the derived "
                             "distroseries."),
                     required=True),
        overlays=List(title=_(
            "The list of booleans indicating, for each parent, if "
            "the parent/child relationship should be an overlay."),
                      value_type=Bool(),
                      required=False),
        overlay_pockets=List(title=_("The list of overlay pockets."),
                             value_type=TextLine(),
                             required=False),
        overlay_components=List(title=_("The list of overlay components."),
                                value_type=TextLine(),
                                required=False),
    )
    @call_with(user=REQUEST_USER)
    @export_write_operation()
    def initDerivedDistroSeries(user,
                                parents,
                                architectures=[],
                                archindep_archtag=None,
                                packagesets=[],
                                rebuild=False,
                                overlays=[],
                                overlay_pockets=[],
                                overlay_components=[]):
        """Initialize this series from parents.
Exemplo n.º 31
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""")
Exemplo n.º 32
0
class IDatagridField(IBaseField):
    """ Text field schema
    """
    widget = Choice(
            vocabulary=SimpleVocabulary.fromItems(
                [("Always dynamic", "REGULAR"),
                    ("Static in read mode", "READ_STATIC"),
                    ]),
            title=u'Widget',
            description=u'Field rendering',
            default="REGULAR",
            required=True)

    associated_form = Choice(
            vocabulary='Products.CMFPlomino.fields.vocabularies.get_forms',
            title=u'Associated form',
            description=u'Form to use to create/edit rows',
            required=False)

    field_mapping = TextLine(
            title=u'Columns/fields mapping',
            description=u'Field ids from the associated form, '
                    'ordered as the columns, separated by commas',
            required=False)

    jssettings = Text(
            title=u'Javascript settings',
            description=u'jQuery datatable parameters',
            default=u"""
"aoColumns": [
    { "sTitle": "Column 1" },
    { "sTitle": "Column 2", "sClass": "center" }
],
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bSort": false,
"bInfo": false,
"bAutoWidth": false,
"plominoDialogOptions": {
        "width": 400,
        "height": 300
    }
""",
            required=False)
Exemplo n.º 33
0
 def constraint(self, value):
     """Make sure that the value is a valid name."""
     super_constraint = TextLine.constraint(self, value)
     return super_constraint and valid_name(value)