Example #1
0
 class IMyComplexObject(Interface):
     """Complex object interface"""
     subobject = Object(title='my object', schema=IMySecond)
     name = TextLine(title='name')
Example #2
0
 class IObjectWidgetMultiIntegration(Interface):
     """Multi-integration interface"""
     subobj = Object(title=OBJECT_LABEL,
                     schema=IObjectWidgetMultiSubIntegration)
Example #3
0
class IPlone4BioConfigurationSchema(Interface):
    dbxref_patterns = List(title=u'Dbxref patterns',
                           description=_(u'help_dbxref_patterns', ),
                           value_type=Object(IDbxrefPattern,
                                             title=u"dbxref pattern"))
Example #4
0
 class IMySecond(Interface):
     """Second interface"""
     subfield = Object(title="Second-subobject",
                       schema=IMySubObject)
     moofield = TextLine(title="Something")
Example #5
0
class IActionMenuContext(Interface):
    """Schema for attributes required by ActionMenuViewletManager."""

    target = Object(Interface)
class IArchiveSigningKey(Interface):
    """`ArchiveSigningKey` interface.

    `IArchive` adapter for operations using its 'signing_key'.

    Note that this adapter only works on zopeless mode for generating
    new signing keys.
    """

    archive = Object(
        title=_('Corresponding IArchive'), required=True, schema=IArchive)

    def getPathForSecretKey(key):
        """Return the absolute path to access a secret key export.

        Disk location specified in the configurarion, for storing a
        secret key, e.g.:

        /<ppa.signing_keys_root>/<FINGERPRINT>.gpg

        :param key: a secret `PymeKey` object to be exported.
        :return: path to the key export.
        """

    def exportSecretKey(key):
        """Export the given secret key into a private location.

        Place a ASCII armored export of the given secret key in the
        location specified by `getPathForSecretKey`.

        :param key: a secret `PymeKey` object to be exported.
        :raises AssertionError: if the given key is public.
        """

    def generateSigningKey():
        """Generate a new GPG secret/public key pair.

        For named-ppas, the existing signing-key for the default PPA
        owner by the same user/team is reused. The *trust* belongs to
        the archive maintainer (owner) not the archive itself.

        Default ppas get brand new keys via the following procedure.

         * Export the secret key in the configuration disk location;
         * Upload the public key to the configuration keyserver;
         * Store a reference for the public key in GPGKey table, which
           is set as the context archive 'signing_key'.

        :raises AssertionError: if the context archive already has a
            `signing_key`.
        :raises GPGUploadFailure: if the just-generated key could not be
            upload to the keyserver.
        """

    def setSigningKey(key_path):
        """Set a given secret key export as the context archive signing key.

        :raises AssertionError: if the context archive already has a
            `signing_key`.
        :raises AssertionError: if the given 'key_path' does not exist.
        """

    def signRepository(suite):
        """Sign the corresponding repository.
Example #7
0
class IHasListOfDerived(IRootInterface):

    the_objects = List(Object(IDerivedWithOneTextField))

    taggedValue('__external_class_name__',
                'HasListOfDerived')
Example #8
0
class IGlobalRoot(interface.Interface):
    field = Object(IGlobalMiddleThing)
Example #9
0
 def setUp(self):
     super(ObjectWidgetTest, self).setUp()
     self.field = Object(ITestContact, __name__=u'foo')
     provideAdapter(TextWidget, (ITextLine, IDefaultBrowserLayer),
                    IInputWidget)
Example #10
0
class IDistributionPublic(
    IBugTarget, ICanGetMilestonesDirectly, IHasAppointedDriver,
    IHasBuildRecords, IHasDrivers, IHasMilestones, IHasSharingPolicies,
    IHasOOPSReferences, IHasOwner, IHasSprints, IHasTranslationImports,
    ITranslationPolicy, IKarmaContext, ILaunchpadUsage, IMakesAnnouncements,
    IOfficialBugTagTargetPublic, IPillar, IServiceUsage,
    ISpecificationTarget, IHasExpirableBugs):
    """Public IDistribution properties."""

    id = Attribute("The distro's unique number.")
    name = exported(
        DistributionNameField(
            title=_("Name"),
            constraint=name_validator,
            description=_("The distro's name."), required=True))
    displayname = exported(
        TextLine(
            title=_("Display Name"),
            description=_("The displayable name of the distribution."),
            required=True),
        exported_as='display_name')
    title = exported(
        Title(
            title=_("Title"),
            description=_("The distro's title."), required=True))
    summary = exported(
        Summary(
            title=_("Summary"),
            description=_(
                "A short paragraph to introduce the goals and highlights "
                "of the distribution."),
            required=True))
    homepage_content = exported(
        Text(
            title=_("Homepage Content"), required=False,
            description=_(
                "The content of this distribution's home page. Edit this and "
                "it will be displayed for all the world to see. It is NOT a "
                "wiki so you cannot undo changes.")))
    icon = exported(
        IconImageUpload(
            title=_("Icon"), required=False,
            default_image_resource='/@@/distribution',
            description=_(
                "A small image of exactly 14x14 pixels and at most 5kb in "
                "size, that can be used to identify this distribution. The "
                "icon will be displayed everywhere we list the distribution "
                "and link to it.")))
    logo = exported(
        LogoImageUpload(
            title=_("Logo"), required=False,
            default_image_resource='/@@/distribution-logo',
            description=_(
                "An image of exactly 64x64 pixels that will be displayed in "
                "the heading of all pages related to this distribution. It "
                "should be no bigger than 50kb in size.")))
    mugshot = exported(
        MugshotImageUpload(
            title=_("Brand"), required=False,
            default_image_resource='/@@/distribution-mugshot',
            description=_(
                "A large image of exactly 192x192 pixels, that will be "
                "displayed on this distribution's home page in Launchpad. "
                "It should be no bigger than 100kb in size. ")))
    description = exported(
        Description(
            title=_("Description"),
            description=_(
                "Details about the distributions's work, highlights, goals, "
                "and how to contribute. Use plain text, paragraphs are "
                "preserved and URLs are linked in pages. Don't repeat the "
                "Summary."),
            required=True))
    domainname = exported(
        TextLine(
            title=_("Web site URL"),
            description=_("The distro's web site URL."), required=True),
        exported_as='domain_name')
    owner = exported(
        PublicPersonChoice(
            title=_("Owner"),
            required=True,
            vocabulary='ValidPillarOwner',
            description=_("The restricted team, moderated team, or person "
                          "who maintains the distribution information in "
                          "Launchpad.")))
    registrant = exported(
        PublicPersonChoice(
            title=_("Registrant"), vocabulary='ValidPersonOrTeam',
            description=_("The distro's registrant."), required=True,
            readonly=True))
    date_created = exported(
        Datetime(title=_('Date created'),
                 description=_("The date this distribution was registered.")))
    driver = exported(
        PublicPersonChoice(
            title=_("Driver"),
            description=_(
                "The person or team responsible for decisions about features "
                "and bugs that will be targeted for any series in this "
                "distribution. Note that you can also specify a driver "
                "on each series whose permissions will be limited to that "
                "specific series."),
            required=False, vocabulary='ValidPersonOrTeam'))
    drivers = Attribute(
        "Presents the distro driver as a list for consistency with "
        "IProduct.drivers where the list might include a project driver.")
    members = exported(PublicPersonChoice(
        title=_("Members"),
        description=_("The distro's members team."), required=True,
        vocabulary='ValidPersonOrTeam'))
    mirror_admin = exported(PublicPersonChoice(
        title=_("Mirror Administrator"),
        description=_("The person or team that has the rights to review and "
                      "mark this distribution's mirrors as official."),
        required=True, vocabulary='ValidPersonOrTeam'))
    archive_mirrors = exported(doNotSnapshot(
        CollectionField(
            description=_("All enabled and official ARCHIVE mirrors "
                          "of this Distribution."),
            readonly=True, value_type=Object(schema=IDistributionMirror))))
    archive_mirrors_by_country = doNotSnapshot(CollectionField(
            description=_("All enabled and official ARCHIVE mirrors "
                          "of this Distribution."),
            readonly=True, value_type=Object(schema=IDistributionMirror)))
    cdimage_mirrors = exported(doNotSnapshot(
        CollectionField(
            description=_("All enabled and official RELEASE mirrors "
                          "of this Distribution."),
            readonly=True, value_type=Object(schema=IDistributionMirror))))
    cdimage_mirrors_by_country = doNotSnapshot(CollectionField(
            description=_("All enabled and official ARCHIVE mirrors "
                          "of this Distribution."),
            readonly=True, value_type=Object(schema=IDistributionMirror)))
    disabled_mirrors = Attribute(
        "All disabled and official mirrors of this Distribution.")
    unofficial_mirrors = Attribute(
        "All unofficial mirrors of this Distribution.")
    pending_review_mirrors = Attribute(
        "All mirrors of this Distribution that haven't been reviewed yet.")
    series = exported(doNotSnapshot(
        CollectionField(
            title=_("DistroSeries inside this Distribution"),
            # Really IDistroSeries, see _schema_circular_imports.py.
            value_type=Reference(schema=Interface))))
    derivatives = exported(doNotSnapshot(
        CollectionField(
            title=_("This Distribution's derivatives"),
            # Really IDistroSeries, see _schema_circular_imports.py.
            value_type=Reference(schema=Interface))))
    architectures = List(
        title=_("DistroArchSeries inside this Distribution"))
    uploaders = Attribute(_(
        "ArchivePermission records for uploaders with rights to upload to "
        "this distribution."))
    package_derivatives_email = TextLine(
        title=_("Package Derivatives Email Address"),
        description=_(
            "The email address to send information about updates to packages "
            "that are derived from another distribution. The sequence "
            "{package_name} is replaced with the actual package name."),
        required=False)

    # properties
    currentseries = exported(
        Reference(
            # Really IDistroSeries, see _schema_circular_imports.py.
            Interface,
            title=_("Current series"),
            description=_(
                "The current development series of this distribution. "
                "Note that all maintainerships refer to the current "
                "series. When people ask about the state of packages "
                "in the distribution, we should interpret that query "
                "in the context of the currentseries.")),
        exported_as="current_series")

    full_functionality = Attribute(
        "Whether or not we enable the full functionality of Launchpad for "
        "this distribution. Currently only Ubuntu and some derivatives "
        "get the full functionality of LP")

    translation_focus = Choice(
        title=_("Translation focus"),
        description=_(
            "The release series that translators should focus on."),
        required=False,
        vocabulary='FilteredDistroSeries')

    language_pack_admin = Choice(
        title=_("Language Pack Administrator"),
        description=_("The distribution language pack administrator."),
        required=False, vocabulary='ValidPersonOrTeam')

    main_archive = exported(
        Reference(
            title=_('Distribution Main Archive.'), readonly=True,
            # Really IArchive, see _schema_circular_imports.py.
            schema=Interface))

    all_distro_archives = exported(doNotSnapshot(
        CollectionField(
            title=_(
                "A sequence of the distribution's primary, "
                "partner and debug archives."),
            readonly=True, required=False,
            value_type=Reference(schema=Interface))),
                # Really IArchive, see _schema_circular_imports.py.
        exported_as='archives')

    all_distro_archive_ids = Attribute(
        "A list containing the IDs of all the non-PPA archives.")

    has_published_binaries = Bool(
        title=_("Has Published Binaries"),
        description=_("True if this distribution has binaries published "
                      "on disk."),
        readonly=True, required=False)

    has_published_sources = Bool(
        title=_("Has Published Sources"),
        description=_("True if this distribution has sources published."),
        readonly=True, required=False)

    redirect_release_uploads = exported(Bool(
        title=_("Redirect release pocket uploads"),
        description=_("Redirect release pocket uploads to proposed pocket"),
        readonly=False, required=True))

    development_series_alias = exported(DistroSeriesNameField(
        title=_("Alias for development series"),
        description=_(
            "If set, an alias for the current development series in this "
            "distribution."),
        constraint=name_validator, readonly=False, required=False))

    def getArchiveIDList(archive=None):
        """Return a list of archive IDs suitable for sqlvalues() or quote().

        If the archive param is supplied, just its ID will be returned in
        a list of one item.  If it is not supplied, return a list of
        all the IDs for all the archives for the distribution.
        """

    def __getitem__(name):
        """Returns a DistroSeries that matches name, or raises and
        exception if none exists."""

    def __iter__():
        """Iterate over the series for this distribution."""

    @operation_parameters(
        name=TextLine(title=_("Archive name"), required=True))
    @operation_returns_entry(Interface)
    @export_read_operation()
    def getArchive(name):
        """Return the distribution archive with the given name.

        Only distribution archives are considered -- PPAs will not be found.

        :param name: The name of the archive, e.g. 'partner'
        """

    # Really IDistroSeries, see _schema_circular_imports.py.
    @operation_returns_collection_of(Interface)
    @export_operation_as(name="getDevelopmentSeries")
    @export_read_operation()
    def getDevelopmentSeries():
        """Return the DistroSeries which are marked as in development."""

    def resolveSeriesAlias(name):
        """Resolve a series alias.

        :param name: The name to resolve.
        :raises NoSuchDistroSeries: If there is no match.
        """

    @operation_parameters(
        name_or_version=TextLine(title=_("Name or version"), required=True))
    # Really IDistroSeries, see _schema_circular_imports.py.
    @operation_returns_entry(Interface)
    @call_with(follow_aliases=True)
    @export_read_operation()
    def getSeries(name_or_version, follow_aliases=False):
        """Return the series with the name or version given.

        :param name_or_version: The `IDistroSeries.name` or
            `IDistroSeries.version`.
        """

    # This API is specifically for Ensemble's Principia.  It does not scale
    # well to distributions of Ubuntu's scale, and is not intended for it.
    # Therefore, this should probably never be exposed for a webservice
    # version other than "devel".
    @operation_parameters(
        since=Datetime(
            title=_("Time of last change"),
            description=_(
                "Return branches that have new tips since this timestamp."),
            required=False))
    @call_with(user=REQUEST_USER)
    @export_operation_as(name="getBranchTips")
    @export_read_operation()
    @operation_for_version('devel')
    def getBranchTips(user=None, since=None):
        """Return a list of branches which have new tips since a date.

        Each branch information is a tuple of (branch_unique_name,
        tip_revision, (official_series*)).

        So for each branch in the distribution, you'll get the branch unique
        name, the revision id of tip, and if the branch is official for some
        series, the list of series name.

        :param: user: If specified, shows the branches visible to that user.
            if not specified, only branches visible to the anonymous user are
            shown.

        :param since: If specified, limits results to branches modified since
            that date and time.
        """

    @operation_parameters(
        name=TextLine(title=_("Name"), required=True))
    @operation_returns_entry(IDistributionMirror)
    @export_read_operation()
    def getMirrorByName(name):
        """Return the mirror with the given name for this distribution or None
        if it's not found.
        """

    @operation_parameters(
        country=copy_field(IDistributionMirror['country'], required=True),
        mirror_type=copy_field(IDistributionMirror['content'], required=True))
    @operation_returns_entry(IDistributionMirror)
    @export_read_operation()
    def getCountryMirror(country, mirror_type):
        """Return the country DNS mirror for a country and content type."""

    def newMirror(owner, speed, country, content, displayname=None,
                  description=None, http_base_url=None,
                  ftp_base_url=None, rsync_base_url=None, enabled=False,
                  official_candidate=False, whiteboard=None):
        """Create a new DistributionMirror for this distribution.

        At least one of http_base_url or ftp_base_url must be provided in
        order to create a mirror.
        """

    @operation_parameters(
        name=TextLine(title=_("Package name"), required=True))
    # Really returns IDistributionSourcePackage, see
    # _schema_circular_imports.py.
    @operation_returns_entry(Interface)
    @export_read_operation()
    def getSourcePackage(name):
        """Return a DistributionSourcePackage with the given name for this
        distribution, or None.
        """

    def getSourcePackageRelease(sourcepackagerelease):
        """Returns an IDistributionSourcePackageRelease

        Receives a sourcepackagerelease.
        """

    def getCurrentSourceReleases(source_package_names):
        """Get the current release of a list of source packages.

        :param source_package_names: a list of `ISourcePackageName`
            instances.

        :return: a dict where the key is a `IDistributionSourcePackage`
            and the value is a `IDistributionSourcePackageRelease`.
        """

    def getDistroSeriesAndPocket(distroseriesname, follow_aliases=False):
        """Return a (distroseries,pocket) tuple which is the given textual
        distroseriesname in this distribution."""

    def getSeriesByStatus(status):
        """Query context distribution for distroseries with a given status.

        :param status: Series status to look for
        :return: list of `IDistroSeries`
        """

    @rename_parameters_as(text="source_match")
    @operation_parameters(
        text=TextLine(title=_("Source package name substring match"),
                      required=True))
    # Really returns IDistributionSourcePackage, see
    # _schema_circular_imports.py.
    @operation_returns_collection_of(Interface)
    @export_read_operation()
    def searchSourcePackages(
        text, has_packaging=None, publishing_distroseries=None):
        """Search for source packages that correspond to the given text.

        This method just decorates the result of searchSourcePackageCaches()
        to return DistributionSourcePackages.
        """

    def searchSourcePackageCaches(
        text, has_packaging=None, publishing_distroseries=None):
        """Search for source packages that correspond to the given text.

        :param text: The text that will be matched.
        :param has_packaging: If True, it will filter out
            packages with no packaging (i.e. no link to the upstream
            project). False will do the reverse filtering, and None
            will do no filtering on this field.
        :param publishing_distroseries: If it is not None, then
            it will filter out source packages that do not have a
            publishing history for the given distroseries.
        :return: A result set containing
            (DistributionSourcePackageCache, SourcePackageName, rank) tuples
            ordered by rank.
        """

    def searchBinaryPackages(package_name, exact_match=False):
        """Search for binary packages in this distribution.

        :param package_name: The binary package name to match.
        :param exact_match: If False, substring matches are done on the
            binary package names; if True only a full string match is
            returned.
        :return: A result set containing appropriate DistributionSourcePackage
            objects for the matching source.

        The returned results will consist of source packages that match
        (a substring of) their binary package names.
        """

    def guessPublishedSourcePackageName(pkgname):
        """Return the "published" SourcePackageName related to pkgname.

        If pkgname corresponds to a source package that was published in
        any of the distribution series, that's the SourcePackageName that is
        returned.

        If there is any official source package branch linked, then that
        source package name is returned.

        Otherwise, try to find a published binary package name and then return
        the source package name from which it comes from.

        :raises NotFoundError: when pkgname doesn't correspond to either a
            published source or binary package name in this distribution.
        """

    def getAllPPAs():
        """Return all PPAs for this distribution."""

    def searchPPAs(text=None, show_inactive=False):
        """Return all PPAs matching the given text in this distribution.

        'text', when passed, will restrict results to Archives with matching
        description (using substring) or matching Archive.owner (using
        available person fti/ftq).

        'show_inactive', when False, will restrict results to Archive with
        at least one source publication in PENDING or PUBLISHED status.
        """

    def getPendingAcceptancePPAs():
        """Return only pending acceptance PPAs in this distribution."""

    def getPendingPublicationPPAs():
        """Return all PPAs in this distribution that are pending publication.

        A PPA is said to be pending publication if it has publishing records
        in the pending state or if it had packages deleted from it.
        """

    def getArchiveByComponent(component_name):
        """Return the archive most appropriate for the component name.

        Where different components may imply a different archive (e.g.
        partner), this method will return the archive for that component.

        If the component_name supplied is unknown, None is returned.
        """

    def getAllowedBugInformationTypes():
        """Get the information types that a bug in this distribution can have.

        :return: A sequence of `InformationType`s.
        """

    def getDefaultBugInformationType():
        """Get the default information type of a new bug in this distro.

        :return: The `InformationType`.
        """

    def userCanEdit(user):
        """Can the user edit this distribution?"""
class IPackageCopyRequest(Interface):
    """A Build interface"""

    id = Int(title=_('ID'), required=True, readonly=True)

    target_archive = Object(
        title=_("Target archive"),
        schema=IArchive,
        required=True,
        readonly=True,
        description=_("The archive to which packages will be copied."))

    target_distroseries = Object(title=_("Target distroseries"),
                                 schema=IDistroSeries,
                                 required=False,
                                 readonly=True,
                                 description=_("The target DistroSeries."))

    target_component = Object(title=_("Target component"),
                              schema=IComponent,
                              required=False,
                              readonly=True,
                              description=_("The target component."))

    target_pocket = Choice(title=_('Target pocket'),
                           required=False,
                           vocabulary=PackagePublishingPocket,
                           description=_("The target pocket."))

    copy_binaries = Bool(
        title=_('Copy binaries'),
        required=True,
        default=False,
        description=_("Whether binary packages should be copied as well."))

    source_archive = Object(
        title=_("Source archive"),
        schema=IArchive,
        required=True,
        readonly=True,
        description=_("The archive from which packages will be copied."))

    source_distroseries = Object(title=_("Source distroseries"),
                                 schema=IDistroSeries,
                                 required=False,
                                 readonly=True,
                                 description=_("The source DistroSeries."))

    source_component = Object(title=_("Source component"),
                              schema=IComponent,
                              required=False,
                              readonly=True,
                              description=_("The source component."))

    source_pocket = Choice(title=_('Source pocket'),
                           required=False,
                           vocabulary=PackagePublishingPocket,
                           description=_("The source pocket."))

    requester = Object(
        title=_("Requester"),
        schema=IPerson,
        required=True,
        readonly=True,
        description=_("The person who requested the package copy operation."))

    status = Choice(title=_('Copy status'),
                    required=True,
                    vocabulary=PackageCopyStatus,
                    description=_("The current status of the copy operation."))

    reason = Text(title=_('Reason'),
                  required=False,
                  description=_("The reason for this package copy operation."))

    date_created = Datetime(
        title=_('Date created'),
        required=True,
        readonly=True,
        description=_("The time when the package copy request was created."))

    date_started = Datetime(
        title=_('Date started'),
        required=False,
        readonly=False,
        description=_("The time when the copy request processing started."))

    date_completed = Datetime(
        title=_('Date completed'),
        required=False,
        readonly=False,
        description=_("The time when the copy request processing completed."))

    def __str__():
        """Return a textual representation of the package copy request."""

    def markAsInprogress():
        """Mark this request as being in progress.

        Update the 'status' and 'date_started' properties as appropriate.
        """

    def markAsCompleted():
        """Mark this request as completed.

        Update the 'status' and 'date_completed' properties as appropriate.
        """

    def markAsFailed():
        """Mark this request as failed.

        Update the 'status' and 'date_completed' properties as appropriate.
        """

    def markAsCanceling():
        """Mark this request as canceling.

        Update the 'status' as appropriate.
        """

    def markAsCancelled():
        """Mark this request as cancelled.
Example #12
0
 def _FieldFactory(self, **kw):
     kw.update({
         '__name__': u'foo',
         'value_type': Object(__name__=u'bar', schema=IFoo)
     })
     return Tuple(**kw)
Example #13
0
class IMessageApproval(Interface):
    """A held message."""

    message_id = Text(
        title=_('Message-ID'),
        description=_('The RFC 2822 Message-ID header.'),
        required=True, readonly=True)

    posted_by = PublicPersonChoice(
        title=_('Posted by'),
        description=_('The Launchpad member who posted the message.'),
        vocabulary='ValidPersonOrTeam',
        required=True, readonly=True)

    posted_message = Object(
        schema=ILibraryFileAlias,
        title=_('Posted message'),
        description=_('An alias to the posted message in the librarian.'),
        required=True, readonly=True)

    message = Object(
        schema=IMessage,
        title=_('The posted message object'),
        description=_('The posted message'),
        required=True, readonly=True)

    posted_date = Datetime(
        title=_('Date posted'),
        description=_('The date this message was posted.'),
        required=True, readonly=True)

    mailing_list = Object(
        schema=IMailingList,
        title=_('The mailing list'),
        description=_('The mailing list this message was posted to.'),
        required=True, readonly=True)

    status = Choice(
        title=_('Status'),
        description=_('The status of the held message.'),
        vocabulary='PostedMessageStatus',
        required=True)

    disposed_by = PublicPersonChoice(
        title=_('Approved or rejected by'),
        description=_('The person who approved or rejected this message.'),
        vocabulary='ValidPersonOrTeam',
        required=False)

    disposal_date = Datetime(
        title=_('Date approved or rejected'),
        description=_('The date this message was approved or rejected.'),
        required=False)

    def approve(reviewer):
        """Approve the message.

        Set the status to APPROVAL_PENDING, indicating that the reviewer has
        chosen to approve the message, but that Mailman has not yet
        acknowledged this disposition.

        :param reviewer: The person who did the review.
        """

    def reject(reviewer):
        """Reject the message.

        Set the status to REJECTION_PENDING, indicating that the reviewer has
        chosen to reject (i.e. bounce) the message, but that Mailman has not
        yet acknowledged this disposition.

        :param reviewer: The person who did the review.
        """

    def discard(reviewer):
        """Discard the message.

        Set the status to DISCARD_PENDING, indicating that the reviewer has
        chosen to discard the message, but that Mailman has not yet
        acknowledged this disposition.

        :param reviewer: The person who did the review.
        """

    def acknowledge():
        """Acknowledge the pending status of a message.
Example #14
0
class IMailingListSet(Interface):
    """A set of mailing lists."""

    title = TextLine(
        title=_('Title'),
        description=_('The hard coded title.'),
        readonly=True)

    def new(team, registrant=None):
        """Register a new team mailing list.

        A mailing list for the team is registered and the resulting
        `IMailingList` is returned.  The registration time will be set to the
        current time.  The team must not yet have a mailing list.

        :param team: The team to register a new mailing list for.
        :param registrant: The person registering the mailing list.  This must
            be the team owner or one of the team admins.  If None, the team
            owner is used.
        :raises AssertionError: When `team` is not a team, already has a
            mailing list registered for it, or the registrant is not a team
            owner or admin.
        """

    def get(team_name):
        """Return the `IMailingList` associated with the given team name.

        :param team_name: The name of the team to get the mailing list for.
        :return: The `IMailingList` for the named team or None if no mailing
            list is registered for the named team, or the team doesn't exist.
        :raises AssertionError: When `team_name` is not a string.
        """

    def getSubscriptionsForTeams(person, teams):
        """Return a person's subscriptions to usable lists for a set of teams.

        :param person: An `IPerson`.
        :param teams: A list of `ITeam`s.
        :return: A dictionary mapping team IDs to tuples of `IMailingList`
            IDs and `IMailingListSubscription` IDs; the second element will
            be None if a team has a list to which the person is not
            subscribed.
        """

    def getSubscribedAddresses(team_names):
        """Return the set of subscribed email addresses for members.

        :param team_names: The set of teams to query.
        :type team_names: sequence of strings
        :return: A dictionary of lists.  The dictionary's keys are the
            team names given in the argument.  The values are lists of
            2-tuples for all the subscribed members of that mailing lists, in
            no particular order.  This represents all the addresses which will
            receive messages posted to that mailing list.  The 2-tuple is of
            the format (Full Name, email address)
        :rtype: dictionary mapping team names to lists of 2-tuples
        """

    def getSenderAddresses(team_names):
        """Return the set of all email addresses for members.

        :param team_names: The set of teams to query.
        :type team_names: sequence of strings
        :return: A dictionary of lists.  The dictionary's keys are the
            team names given in the argument.  The values are lists of
            2-tuples for all the members of that mailing list's team, in no
            particular order.  This represents all the addresses which are
            allowed to post messages to that mailing list.  The 2-tuple is of
            the format (Full Name, email address)
        :rtype: dictionary mapping team names to iterators
        """

    approved_lists = Set(
        title=_('Approved lists'),
        description=_(
            'All mailing lists with status `MailingListStatus.APPROVED`.'),
        value_type=Object(schema=IMailingList),
        readonly=True)

    active_lists = Set(
        title=_('Active lists'),
        description=_(
            'All mailing lists with status `MailingListStatus.ACTIVE`.'),
        value_type=Object(schema=IMailingList),
        readonly=True)

    modified_lists = Set(
        title=_('Modified lists'),
        description=_(
            'All mailing lists with status `MailingListStatus.MODIFIED`.'),
        value_type=Object(schema=IMailingList),
        readonly=True)

    deactivated_lists = Set(
        title=_('Deactivated lists'),
        description=_('All mailing lists with status '
                      '`MailingListStatus.DEACTIVATING`.'),
        value_type=Object(schema=IMailingList),
        readonly=True)

    unsynchronized_lists = Set(
        title=_('Unsynchronized lists'),
        description=_(
            'All mailing lists with unsynchronized state, e.g. '
            '`MailingListStatus.CONSTRUCTING` and '
            '`MailingListStatus.UPDATING`.'),
        value_type=Object(schema=IMailingList),
        readonly=True)
Example #15
0
class ISourcePackagePublic(IBugTarget, IHasBranches, IHasMergeProposals,
                           IHasOfficialBugTags, IHasCodeImports,
                           IHasTranslationImports, IHasTranslationTemplates,
                           IHasDrivers, IHasOwner):
    """Public attributes for SourcePackage."""

    name = exported(
        TextLine(title=_("Name"),
                 required=True,
                 readonly=True,
                 description=_("The text name of this source package.")))

    display_name = exported(TextLine(
        title=_("Display name"),
        required=True,
        readonly=True,
        description=_("A displayname, constructed, for this package")),
                            exported_as="displayname")

    displayname = Attribute("Display name (deprecated)")

    path = Attribute("A path to this package, <distro>/<series>/<package>")

    title = Attribute("Title.")

    summary = Attribute(
        'A description of the binary packages built from this package.')

    format = Attribute(
        "Source Package Format. This is the format of the "
        "current source package release for this name in this "
        "distribution or distroseries. Calling this when there is "
        "no current sourcepackagerelease will raise an exception.")

    distinctreleases = Attribute(
        "Return a distinct list "
        "of sourcepackagepublishinghistory for this source package.")

    distribution = exported(
        Reference(
            Interface,
            # Really IDistribution, circular import fixed in
            # _schema_circular_imports.
            title=_("Distribution"),
            required=True,
            readonly=True,
            description=_("The distribution for this source package.")))

    # The interface for this is really IDistroSeries, but importing that would
    # cause circular imports. Set in _schema_circular_imports.
    distroseries = exported(
        Reference(Interface,
                  title=_("Distribution Series"),
                  required=True,
                  readonly=True,
                  description=_("The DistroSeries for this SourcePackage")))

    sourcepackagename = Attribute("SourcePackageName")

    # This is really a reference to an IProductSeries.
    productseries = exported(
        ReferenceChoice(
            title=_("Project series"),
            required=False,
            vocabulary="ProductSeries",
            readonly=True,
            schema=Interface,
            description=_(
                "The registered project series that this source package "
                "is based on. This series may be the same as the one that "
                "earlier versions of this source packages were based on.")))

    releases = Attribute(
        "The full set of source package releases that "
        "have been published in this distroseries under this source "
        "package name. The list should be sorted by version number.")

    currentrelease = Attribute("""The latest published SourcePackageRelease
        of a source package with this name in the distribution or
        distroseries, or None if no source package with that name is
        published in this distroseries.""")

    direct_packaging = Attribute(
        "Return the Packaging record that is "
        "explicitly for this distroseries and source package name, "
        "or None if such a record does not exist. You should probably "
        "use ISourcePackage.packaging, which will also look through the "
        "distribution ancestry to find a relevant packaging record.")

    packaging = Attribute(
        "The best Packaging record we have for this "
        "source package. If we have one for this specific distroseries "
        "and sourcepackagename, it will be returned, otherwise we look "
        "for a match in parent and ubuntu distro seriess.")

    published_by_pocket = Attribute(
        "The set of source package releases "
        "currently published in this distro series, organised by "
        "pocket. The result is a dictionary, with the pocket dbschema "
        "as a key, and a list of {'spr': source package release, "
        "'component_name': component name} as the value.")

    linked_branches = Attribute(
        "A mapping of pockets to officially linked branches, ordered by "
        "pocket enum value.")

    development_version = Attribute(
        "This package on the distro's current series.")

    distribution_sourcepackage = Attribute(
        "The IDistributionSourcePackage for this source package.")

    drivers = Attribute(
        "The drivers for the distroseries for this source package.")

    owner = Attribute("The owner of the distroseries for this source package.")

    def __hash__():
        """Sourcepackage hash method.

        This is required to make source packages usable as dictionary
        keeps since the __eq__ method is provided.
        """

    def __eq__(other):
        """Sourcepackage comparison method.

        Sourcepackages compare equal only if their distroseries and
        sourcepackagename compare equal.
        """

    def __ne__(other):
        """Sourcepackage comparison method.

        Sourcepackages compare not equal if either of their distroseries or
        sourcepackagename compare not equal.
        """

    @operation_parameters(productseries=Reference(schema=IProductSeries))
    @call_with(owner=REQUEST_USER)
    @export_write_operation()
    @operation_for_version('devel')
    def setPackaging(productseries, owner):
        """Update the existing packaging record, or create a new packaging
        record, that links the source package to the given productseries,
        and record that it was done by the owner.
        """

    @operation_parameters(productseries=Reference(schema=IProductSeries))
    @call_with(owner=REQUEST_USER)
    @export_write_operation()
    @operation_for_version('devel')
    def setPackagingReturnSharingDetailPermissions(productseries, owner):
        """Like setPackaging(), but returns getSharingDetailPermissions().

        This method is intended for AJAX usage on the +sharing-details
        page.
        """

    @export_write_operation()
    @operation_for_version('devel')
    def deletePackaging():
        """Delete the packaging for this sourcepackage."""

    def getSharingDetailPermissions():
        """Return a dictionary of user permissions for +sharing-details page.

        This shows whether the user can change
        - The project series
        - The project series target branch
        - The project series autoimport mode
        - The project translation usage setting
        """

    def getSuiteSourcePackage(pocket):
        """Return the `ISuiteSourcePackage` for this package in 'pocket'.

        :param pocket: A `DBItem` of `PackagePublishingPocket`.
        :return: An `ISuiteSourcePackage`.
        """

    def getPocketPath(pocket):
        """Get the path to the given pocket of this package.

        :param pocket: A `DBItem` of `PackagePublishingPocket`.
        :return: A string.
        """

    @operation_parameters(pocket=Choice(title=_("Pocket"),
                                        required=True,
                                        vocabulary=PackagePublishingPocket))
    # Actually returns an IBranch, but we say Interface here to avoid circular
    # imports. Correct interface specified in _schema_circular_imports.
    @operation_returns_entry(Interface)
    @export_read_operation()
    def getBranch(pocket):
        """Get the official branch for this package in the given pocket.

        :param pocket: A `PackagePublishingPocket`.
        :return: An `IBranch`.
        """

    latest_published_component = Object(
        title=u'The component in which the package was last published.',
        schema=IComponent,
        readonly=True,
        required=False)

    latest_published_component_name = exported(
        TextLine(title=u'The name of the component in which the package'
                 ' was last published.',
                 readonly=True,
                 required=False))

    def get_default_archive(component=None):
        """Get the default archive of this package.

        If 'component' is a partner component, then the default archive is the
        partner archive. Otherwise, the primary archive of the associated
        distribution.

        :param component: The `IComponent` to base the default archive
            decision on. If None, defaults to the last published component.
        :raise NoPartnerArchive: If returning the partner archive is
            appropriate, but no partner archive exists.
        :return: `IArchive`.
        """

    def getLatestTranslationsUploads():
        """Find latest Translations tarballs as produced by Soyuz.

        :return: A list of `ILibraryFileAlias`es, usually of size zero
            or one.  If not, they are sorted from oldest to newest.
        """

    @export_read_operation()
    def linkedBranches():
        """Get the official branches for this package.
Example #16
0
class IGlobalMiddleThing(interface.Interface):
    nested = Object(IGlobalNestedThing)
    nested_dict = Dict(title=u'a dict',
                       value_type=Object(IGlobalNestedThing))
Example #17
0
class IFieldContext(IItem):
    """ A publishable wrapper of a zope 3 schema field
    """

    field = Object(schema=IField)
Example #18
0
 class IRoot(interface.Interface):
     field = List(Object(INestedThing))
Example #19
0
class ISchemaModifiedEvent(IObjectEvent):

    object = Object(
        schema=ISchemaContext
    )
Example #20
0
class IForm(Interface):
    """Form interface"""

    mode = Choice(title=_('Mode'),
                  description=_('The mode in which to render the widgets.'),
                  values=(INPUT_MODE, DISPLAY_MODE),
                  required=True)

    ignore_context = Bool(
        title=_('Ignore Context'),
        description=_('If set the context is ignored to retrieve a value.'),
        default=False,
        required=True)

    ignore_request = Bool(
        title=_('Ignore Request'),
        description=_('If set the request is ignored to retrieve a value.'),
        default=False,
        required=True)

    ignore_readonly = Bool(
        title=_('Ignore Readonly'),
        description=_('If set then readonly fields will also be shown.'),
        default=False,
        required=True)

    ignore_required_on_extract = Bool(
        title=_('Ignore Required validation on extract'),
        description=_(
            "If set then required fields will pass validation "
            "on extract regardless whether they're filled in or not"),
        default=False,
        required=True)

    widgets = Object(
        title=_('Widgets'),
        description=_('A widget manager containing the widgets to be used in '
                      'the form.'),
        schema=IWidgets)

    title = TextLine(title=_('Title'),
                     description=_('Main form title'),
                     required=False)

    legend = TextLine(
        title=_('Legend'),
        description=_('A human readable text describing the form that can be '
                      'used in the UI.'),
        required=False)

    required_label = TextLine(
        title=_('Required label'),
        description=_('A human readable text describing the form that can '
                      'be used in the UI for rendering a required info '
                      'legend.'),
        required=False)

    prefix = ASCIILine(
        title=_('Prefix'),
        description=_('The prefix of the form used to uniquely identify it.'),
        default='form.')

    status = Text(title=_('Status'),
                  description=_('The status message of the form.'),
                  default=None,
                  required=False)

    def get_content(self):
        """Return the content to be displayed and/or edited."""

    def update_widgets(self, prefix=None):
        """Update the widgets for the form.

        This method is commonly called from the ``update()`` method and is
        mainly meant to be a hook for subclasses.

        Note that you can pass an argument for ``prefix`` to override
        the default value of ``"widgets."``.
        """

    def extract_data(self, set_errors=True):
        """Extract the data of the form.

        set_errors: needs to be passed to extract() and to sub-widgets"""

    def update(self):
        """Update the form."""

    def render(self):
        """Render the form."""

    def json(self):
        """Returns the form in json format"""
class IDistroSeriesPublic(ISeriesMixin, IHasAppointedDriver, IHasOwner,
                          IBugTarget, ISpecificationGoal, IHasMilestones,
                          IHasOfficialBugTags, IHasBuildRecords,
                          IHasTranslationImports, IHasTranslationTemplates,
                          IServiceUsage, IHasExpirableBugs):
    """Public IDistroSeries properties."""

    id = Attribute("The distroseries's unique number.")
    name = exported(
        DistroSeriesNameField(title=_("Name"),
                              required=True,
                              description=_("The name of this series."),
                              constraint=name_validator))
    displayname = exported(
        TextLine(title=_("Display name"),
                 required=True,
                 description=_("The series displayname.")))
    fullseriesname = exported(
        TextLine(title=_("Series full name"),
                 required=False,
                 description=_("The series full name, e.g. Ubuntu Warty")))
    title = exported(
        Title(title=_("Title"),
              required=True,
              description=_(
                  "The title of this series. It should be distinctive "
                  "and designed to look good at the top of a page.")))
    description = exported(
        Description(title=_("Description"),
                    required=True,
                    description=_(
                        "A detailed description of this series, with "
                        "information on the architectures covered, the "
                        "availability of security updates and any other "
                        "relevant information.")))
    version = exported(
        DistroSeriesVersionField(
            title=_("Version"),
            required=True,
            description=_("The version string for this series.")))
    distribution = exported(
        Reference(
            Interface,  # Really IDistribution, see circular import fix below.
            title=_("Distribution"),
            required=True,
            description=_("The distribution for which this is a series.")))
    distributionID = Attribute('The distribution ID.')
    named_version = Attribute('The combined display name and version.')
    parent = Attribute('The structural parent of this series - the distro')
    components = Attribute("The series components.")
    # IComponent is not exported on the api.
    component_names = exported(
        List(value_type=TextLine(),
             title=_(u'The series component names'),
             readonly=True))
    upload_components = Attribute("The series components that can be "
                                  "uploaded to.")
    suite_names = exported(
        List(value_type=TextLine(),
             title=_(u'The series pocket names'),
             readonly=True))
    sections = Attribute("The series sections.")
    status = exported(
        Choice(title=_("Status"), required=True, vocabulary=SeriesStatus))
    datereleased = exported(Datetime(title=_("Date released")))
    previous_series = exported(
        ReferenceChoice(
            title=_("Parent series"),
            description=_("The series from which this one was branched."),
            required=True,
            schema=Interface,  # Really IDistroSeries
            vocabulary='DistroSeries'),
        ("devel", dict(exported_as="previous_series")),
        ("1.0", dict(exported_as="parent_series")),
        ("beta", dict(exported_as="parent_series")),
        readonly=True)
    registrant = exported(
        PublicPersonChoice(title=_("Registrant"),
                           vocabulary='ValidPersonOrTeam'))
    owner = exported(
        Reference(
            IPerson,
            title=_("Owning team of the derived series"),
            readonly=True,
            description=_(
                "This attribute mirrors the owner of the distribution.")))
    date_created = exported(
        Datetime(title=_("The date this series was registered.")))
    driver = exported(
        ReferenceChoice(
            title=_("Driver"),
            description=_(
                "The person or team responsible for decisions about features "
                "and bugs that will be targeted to this series of the "
                "distribution."),
            required=False,
            vocabulary='ValidPersonOrTeam',
            schema=IPerson))
    changeslist = exported(
        TextLine(title=_("E-mail changes to"),
                 required=True,
                 description=_("The mailing list or other e-mail address that "
                               "Launchpad should notify about new uploads."),
                 constraint=email_validator))
    sourcecount = Attribute("Source Packages Counter")
    defer_translation_imports = Bool(
        title=_("Defer translation imports"),
        description=_("Suspends any translation imports for this series"),
        default=True,
        required=True,
    )
    binarycount = Attribute("Binary Packages Counter")

    architecturecount = Attribute("The number of architectures in this "
                                  "series.")
    nominatedarchindep = exported(
        Reference(
            Interface,  # IDistroArchSeries.
            title=_("DistroArchSeries designed to build "
                    "architecture-independent packages whithin this "
                    "distroseries context."),
            default=None,
            required=False))
    messagecount = Attribute("The total number of translatable items in "
                             "this series.")
    distroserieslanguages = Attribute("The set of dr-languages in this "
                                      "series.")

    hide_all_translations = Bool(
        title=u'Hide translations for this release',
        required=True,
        description=(
            u"You may hide all translation for this distribution series so"
            " that only Launchpad administrators will be able to see them."
            " For example, you should hide these translations while they are"
            " being imported from a previous series so that translators"
            " will not be confused by imports that are in progress."),
        default=True)

    language_pack_base = Choice(title=_('Language pack base'),
                                required=False,
                                description=_('''
            Language pack with the export of all translations
            available for this distribution series when it was generated. The
            subsequent update exports will be generated based on this one.
            '''),
                                vocabulary='FilteredFullLanguagePack')

    language_pack_delta = Choice(title=_('Language pack update'),
                                 required=False,
                                 description=_('''
            Language pack with the export of all translation updates
            available for this distribution series since the language pack
            base was generated.
            '''),
                                 vocabulary='FilteredDeltaLanguagePack')

    language_pack_proposed = Choice(title=_('Proposed language pack update'),
                                    required=False,
                                    description=_('''
            Base or update language pack export that is being tested and
            proposed to be used as the new language pack base or
            language pack update for this distribution series.
            '''),
                                    vocabulary='FilteredLanguagePack')

    language_pack_full_export_requested = Bool(
        title=_('Request a full language pack export'),
        required=True,
        description=_('''
            Whether next language pack generation will be a full export. This
            information is useful when update packs are too big and want to
            merge all those changes in the base pack.
            '''))

    last_full_language_pack_exported = Object(
        title=_('Latest exported language pack with all translation files.'),
        required=False,
        readonly=True,
        schema=ILanguagePack)

    last_delta_language_pack_exported = Object(title=_(
        'Lastest exported language pack with updated translation files.'),
                                               required=False,
                                               readonly=True,
                                               schema=ILanguagePack)

    # related joins
    packagings = Attribute("All of the Packaging entries for this "
                           "distroseries.")
    specifications = Attribute("The specifications targeted to this "
                               "series.")

    language_packs = Attribute(
        "All language packs associated with this distribution series.")

    backports_not_automatic = Bool(
        title=_("Don't upgrade to backports automatically"),
        required=True,
        description=_("""
            Set NotAutomatic: yes and ButAutomaticUpgrades: yes in Release
            files generated for the backports pocket. This tells apt to
            automatically upgrade within backports, but not into it.
            """))

    include_long_descriptions = exported(
        Bool(title=_("Include long descriptions in Packages rather than in "
                     "Translation-en"),
             default=True,
             required=True,
             description=_("""
                If True, write long descriptions to the per-architecture
                Packages files; if False, write them to a Translation-en
                file common across architectures instead. Using a common
                file reduces the bandwidth footprint of enabling multiarch
                on clients, which requires downloading Packages files for
                multiple architectures.""")))

    main_archive = exported(
        Reference(
            Interface,  # Really IArchive, see below for circular import fix.
            title=_('Distribution Main Archive')))

    supported = exported(
        Bool(title=_("Supported"),
             description=_(
                 "Whether or not this series is currently supported.")))

    def isUnstable():
        """Whether or not a distroseries is unstable.

        The distribution is "unstable" until it is released; after that
        point, all development on the Release pocket is stopped and
        development moves on to the other pockets.
        """

    def getLatestUploads():
        """Return the latest five source uploads for this DistroSeries.

        It returns a list containing up to five elements as
        IDistroSeriesSourcePackageRelease instances
        """

    # DistroArchSeries lookup properties/methods.
    architectures = Attribute("All architectures in this series.")

    enabled_architectures = exported(
        doNotSnapshot(
            CollectionField(
                title=_("Enabled architectures"),
                description=_("All architectures in this series with the "
                              "'enabled' flag set."),
                value_type=Reference(schema=Interface),  # IDistroArchSeries
                readonly=True)),
        exported_as="architectures")

    virtualized_architectures = Attribute(
        "All architectures in this series where PPA is supported.")

    buildable_architectures = Attribute(
        "All architectures in this series with available chroot tarball.")

    def __getitem__(archtag):
        """Return the distroarchseries for this distroseries with the
        given architecturetag.
        """

    def __str__():
        """Return the name of the distroseries."""

    def getDistroArchSeriesByProcessor(processor):
        """Return the distroarchseries for this distroseries with the
        given architecturetag from a `IProcessor`.

        :param processor: An `IProcessor`
        :return: An `IDistroArchSeries` or None when none was found.
        """

    @operation_parameters(archtag=TextLine(title=_("The architecture tag"),
                                           required=True))
    @operation_returns_entry(Interface)
    @export_read_operation()
    def getDistroArchSeries(archtag):
        """Return the distroarchseries for this distroseries with the
        given architecturetag.
        """

    # End of DistroArchSeries lookup methods.

    def updateStatistics(ztm):
        """Update all the Rosetta stats for this distro series."""

    def updatePackageCount():
        """Update the binary and source package counts for this distro
        series."""

    @operation_parameters(name=TextLine(
        title=_("The name of the source package"), required=True))
    @operation_returns_entry(ISourcePackage)
    @export_read_operation()
    def getSourcePackage(name):
        """Return a source package in this distro series by name.

        The name given may be a string or an ISourcePackageName-providing
        object. The source package may not be published in the distro series.
        """

    def getTranslatableSourcePackages():
        """Return a list of Source packages in this distribution series
        that can be translated.
        """

    def getPrioritizedUnlinkedSourcePackages():
        """Return a list of package summaries that need packaging links.

        A summary is a dict of package (`ISourcePackage`), total_bugs,
        and total_messages (translatable messages).
        """

    def getPrioritizedPackagings():
        """Return a list of packagings that need more upstream information."""

    def getMostRecentlyLinkedPackagings():
        """Return a list of packagings that are the most recently linked.

        At most five packages are returned of those most recently linked to an
        upstream.
        """

    @operation_parameters(
        created_since_date=Datetime(
            title=_("Created Since Timestamp"),
            description=_(
                "Return items that are more recent than this timestamp."),
            required=False),
        status=Choice(
            # Really PackageUploadCustomFormat, patched in
            # _schema_circular_imports.py
            vocabulary=DBEnumeratedType,
            title=_("Package Upload Status"),
            description=_("Return only items that have this status."),
            required=False),
        archive=Reference(
            # Really IArchive, patched in _schema_circular_imports.py
            schema=Interface,
            title=_("Archive"),
            description=_("Return only items for this archive."),
            required=False),
        pocket=Choice(
            # Really PackagePublishingPocket, patched in
            # _schema_circular_imports.py
            vocabulary=DBEnumeratedType,
            title=_("Pocket"),
            description=_("Return only items targeted to this pocket"),
            required=False),
        custom_type=Choice(
            # Really PackageUploadCustomFormat, patched in
            # _schema_circular_imports.py
            vocabulary=DBEnumeratedType,
            title=_("Custom Type"),
            description=_("Return only items with custom files of this "
                          "type."),
            required=False),
        name=TextLine(title=_("Package or file name"), required=False),
        version=TextLine(title=_("Package version"), required=False),
        exact_match=Bool(title=_("Exact match"),
                         description=_(
                             "Whether to filter name and version by exact "
                             "matching."),
                         required=False),
    )
    # Really IPackageUpload, patched in _schema_circular_imports.py
    @operation_returns_collection_of(Interface)
    @export_read_operation()
    def getPackageUploads(status=None,
                          created_since_date=None,
                          archive=None,
                          pocket=None,
                          custom_type=None,
                          name=None,
                          version=None,
                          exact_match=False):
        """Get package upload records for this distribution series.

        :param status: Filter results by this `PackageUploadStatus`, or list
            of statuses.
        :param created_since_date: If specified, only returns items uploaded
            since the timestamp supplied.
        :param archive: Filter results for this `IArchive`.
        :param pocket: Filter results by this `PackagePublishingPocket` or a
            list of `PackagePublishingPocket`.
        :param custom_type: Filter results by this
            `PackageUploadCustomFormat`.
        :param name: Filter results by this file name or package name.
        :param version: Filter results by this version number string.
        :param exact_match: If True, look for exact string matches on the
            `name` and `version` filters.  If False, look for a substring
            match so that e.g. a package "kspreadsheetplusplus" would match
            the search string "spreadsheet".  Defaults to False.
        :return: A result set containing `IPackageUpload`.
        """

    def getUnlinkedTranslatableSourcePackages():
        """Return a list of source packages that can be translated in
        this distribution series but which lack Packaging links.
        """

    def getBinaryPackage(name):
        """Return a DistroSeriesBinaryPackage for this name.

        The name given may be an IBinaryPackageName or a string.  The
        binary package may not be published in the distro series.
        """

    def getSourcePackageRelease(sourcepackagerelease):
        """Return a IDistroSeriesSourcePackageRelease

        sourcepackagerelease is an ISourcePackageRelease.
        """

    def getCurrentSourceReleases(source_package_names):
        """Get the current release of a list of source packages.

        :param source_package_names: a list of `ISourcePackageName`
            instances.

        :return: a dict where the key is a `ISourcePackage`
            and the value is a `IDistroSeriesSourcePackageRelease`.
        """

    def getPublishedSources(sourcepackage_or_name,
                            pocket=None,
                            version=None,
                            include_pending=False,
                            archive=None):
        """Return the SourcePackagePublishingHistory(s)

        Deprecated.  Use IArchive.getPublishedSources instead.

        Given a ISourcePackageName or name.

        If pocket is not specified, we look in all pockets.

        If version is not specified, return packages with any version.

        If 'include_pending' is True, we return also the pending publication
        records, those packages that will get published in the next publisher
        run (it's only useful when we need to know if a given package is
        known during a publisher run, mostly in pre-upload checks)

        If 'archive' is not specified consider publication in the
        main_archive, otherwise respect the given value.
        """

    def getAllPublishedSources():
        """Return all currently published sources for the distroseries.

        Return publications in the main archives only.
        """

    def getAllUncondemnedSources():
        """Return all uncondemned sources for the distroseries.

        An uncondemned publication is one without scheduleddeletiondate set.

        Return publications in the main archives only.
        """

    def getAllPublishedBinaries():
        """Return all currently published binaries for the distroseries.

        Return publications in the main archives only.
        """

    def getAllUncondemnedBinaries():
        """Return all uncondemned binaries for the distroseries.

        An uncondemned publication is one without scheduleddeletiondate set.

        Return publications in the main archives only.
        """

    def getDistroSeriesLanguage(language):
        """Return the DistroSeriesLanguage for this distroseries and the
        given language, or None if there's no DistroSeriesLanguage for this
        distribution and the given language.
        """

    def getDistroSeriesLanguageOrDummy(language):
        """Return the DistroSeriesLanguage for this distroseries and the
        given language, or a DummyDistroSeriesLanguage.
        """

    def createUploadedSourcePackageRelease(sourcepackagename,
                                           version,
                                           maintainer,
                                           builddepends,
                                           builddependsindep,
                                           architecturehintlist,
                                           component,
                                           creator,
                                           urgency,
                                           changelog,
                                           changelog_entry,
                                           dsc,
                                           dscsigningkey,
                                           section,
                                           dsc_maintainer_rfc822,
                                           dsc_standards_version,
                                           dsc_format,
                                           dsc_binaries,
                                           archive,
                                           copyright,
                                           build_conflicts,
                                           build_conflicts_indep,
                                           dateuploaded=None,
                                           source_package_recipe_build=None,
                                           user_defined_fields=None,
                                           homepage=None):
        """Create an uploads `SourcePackageRelease`.

        Set this distroseries set to be the uploadeddistroseries.

        All arguments are mandatory, they are extracted/built when
        processing and uploaded source package:

         :param dateuploaded: timestamp, if not provided will be UTC_NOW
         :param sourcepackagename: `ISourcePackageName`
         :param version: string, a debian valid version
         :param maintainer: IPerson designed as package maintainer
         :param creator: IPerson, package uploader
         :param component: IComponent
         :param section: ISection
         :param urgency: dbschema.SourcePackageUrgency
         :param dscsigningkey: IGPGKey used to sign the DSC file
         :param dsc: string, original content of the dsc file
         :param copyright: string, the original debian/copyright content
         :param changelog: LFA ID of the debian/changelog file in librarian
         :param changelog_entry: string, changelog extracted from the
                                 changesfile
         :param architecturehintlist: string, DSC architectures
         :param builddepends: string, DSC build dependencies
         :param builddependsindep: string, DSC architecture independent build
                                   dependencies.
         :param build_conflicts: string, DSC Build-Conflicts content
         :param build_conflicts_indep: string, DSC Build-Conflicts-Indep
                                       content
         :param dsc_maintainer_rfc822: string, DSC maintainer field
         :param dsc_standards_version: string, DSC standards version field
         :param dsc_format: string, DSC format version field
         :param dsc_binaries:  string, DSC binaries field
         :param archive: IArchive to where the upload was targeted
         :param dateuploaded: optional datetime, if omitted assumed nowUTC
         :param source_package_recipe_build: optional SourcePackageRecipeBuild
         :param user_defined_fields: optional sequence of key-value pairs with
                                     user defined fields.
         :param homepage: optional string with (unchecked) upstream homepage
                          URL
         :return: the just creates `SourcePackageRelease`
        """

    def getComponentByName(name):
        """Get the named component.

        Raise NotFoundError if the component is not in the permitted component
        list for this distroseries.
        """

    def getSectionByName(name):
        """Get the named section.

        Raise NotFoundError if the section is not in the permitted section
        list for this distroseries.
        """

    def addSection(section):
        """SQLObject provided method to fill a related join key section."""

    def getBinaryPackagePublishing(archtag, pocket, component, archive):
        """Get BinaryPackagePublishings in a DistroSeries.

        Can optionally restrict the results by architecturetag, pocket and/or
        component.

        If archive is passed, restricted the results to the given archive,
        if it is suppressed the results will be restricted to the
        distribution 'main_archive'.
        """

    def getSourcePackagePublishing(pocket, component, archive):
        """Return a selectResult of ISourcePackagePublishingHistory.

        According status and pocket.
        If archive is passed, restricted the results to the given archive,
        if it is suppressed the results will be restricted to the
        distribution 'main_archive'.
        """

    def searchPackages(text):
        """Search through the packge cache for this distroseries and return
        DistroSeriesBinaryPackage objects that match the given text.
        """

    def createQueueEntry(pocket,
                         archive,
                         changesfilename=None,
                         changesfilecontent=None,
                         changes_file_alias=None,
                         signingkey=None,
                         package_copy_job=None):
        """Create a queue item attached to this distroseries.

        Create a new `PackageUpload` to the given pocket and archive.

        The default state is NEW.  Any further state changes go through
        the Queue state-machine.

        :param pocket: The `PackagePublishingPocket` to upload to.
        :param archive: The `Archive` to upload to.  Must be for the same
            `Distribution` as this series.
        :param changesfilename: Name for the upload's .changes file.  You may
            specify a changes file by passing both `changesfilename` and
            `changesfilecontent`, or by passing `changes_file_alias`.
        :param changesfilecontent: Text for the changes file.  It will be
            signed and stored in the Librarian.  Must be passed together with
            `changesfilename`; alternatively, you may provide a
            `changes_file_alias` to replace both of these.
        :param changes_file_alias: A `LibraryFileAlias` containing the
            .changes file.  Security warning: unless the file has already
            been checked, this may open us up to replay attacks as per bugs
            159304 and 451396.  Use `changes_file_alias` only if you know
            this can't happen.
        :param signingkey: `IGPGKey` used to sign the changes file, or None if
            it is unsigned.
        :return: A new `PackageUpload`.
        """

    def newArch(architecturetag,
                processor,
                official,
                owner,
                supports_virtualized=False,
                enabled=True):
        """Create a new port or DistroArchSeries for this DistroSeries."""

    def copyTranslationsFromParent(ztm):
        """Copy any translation done in parent that we lack.

        If there is another translation already added to this one, we ignore
        the one from parent.

        The supplied transaction manager will be used for intermediate
        commits to break up large copying jobs into palatable smaller
        chunks.

        This method starts and commits transactions, so don't rely on `self`
        or any other database object remaining valid across this call!
        """

    def getPOFileContributorsByLanguage(language):
        """People who translated strings to the given language.

        The people that translated only IPOTemplate objects that are not
        current will not appear in the returned list.
        """

    def getSuite(pocket):
        """Return the suite for this distro series and the given pocket.

        :param pocket: A `DBItem` of `PackagePublishingPocket`.
        :return: A string.
        """

    def isSourcePackageFormatPermitted(format):
        """Check if the specified source format is allowed in this series.

        :param format: The SourcePackageFormat to check.
        """

    @operation_returns_collection_of(Interface)
    @export_read_operation()
    def getDerivedSeries():
        """Get all `DistroSeries` derived from this one."""

    @operation_returns_collection_of(Interface)
    @export_read_operation()
    def getParentSeries():
        """Get all parent `DistroSeries`."""

    @operation_parameters(
        parent_series=Reference(
            schema=Interface,  # IDistroSeries
            title=_("The parent series to consider."),
            required=False),
        difference_type=Choice(
            vocabulary=DBEnumeratedType,  # DistroSeriesDifferenceType
            title=_("Only return differences of this type."),
            required=False),
        source_package_name_filter=TextLine(title=_(
            "Only return differences for packages matching this "
            "name."),
                                            required=False),
        status=Choice(
            vocabulary=DBEnumeratedType,  # DistroSeriesDifferenceStatus
            title=_("Only return differences of this status."),
            required=False),
        child_version_higher=Bool(title=_(
            "Only return differences for which the child's version "
            "is higher than the parent's."),
                                  required=False),
    )
    @operation_returns_collection_of(Interface)
    @export_read_operation()
    @operation_for_version('devel')
    def getDifferencesTo(parent_series, difference_type,
                         source_package_name_filter, status,
                         child_version_higher):
        """Return the differences between this series and the specified
        parent_series (or all the parent series if parent_series is None).

        :param parent_series: The parent series for which the differences
            should be returned. All parents are considered if this is None.
        :param difference_type: The type of the differences to return.
        :param source_package_name_filter: A package name to use as a filter
            for the differences.
        :param status: The status of the differences to return.
        :param child_version_higher: Only return differences for which the
            child's version is higher than the parent's version.
        """

    def isDerivedSeries():
        """Is this series a derived series?

        A derived series has one or more parent series.
        """

    def isInitializing():
        """Is this series initializing?"""

    def isInitialized():
        """Has this series been initialized?"""

    def getInitializationJob():
        """Get the last `IInitializeDistroSeriesJob` for this series.

        :return: `None` if no job is found or an `IInitializeDistroSeriesJob`.
        """

    @operation_parameters(
        since=Datetime(
            title=_("Minimum creation timestamp"),
            description=_("Ignore comments that are older than this."),
            required=False),
        source_package_name=TextLine(
            title=_("Name of source package"),
            description=_("Only return comments for this source package."),
            required=False))
    @operation_returns_collection_of(Interface)
    @export_read_operation()
    @operation_for_version('devel')
    def getDifferenceComments(since=None, source_package_name=None):
        """Get `IDistroSeriesDifferenceComment` items.
Example #22
0
class IPOTMsgSet(Interface):
    """A collection of message IDs."""

    id = Int(title=_("The identifier of this POTMsgSet."),
             readonly=True,
             required=True)

    context = Text(
        title=u"String used to disambiguate messages with identical msgids.")

    msgid_singular = Object(title=_("The singular msgid for this message."),
                            description=_("""
            A message ID along with the context uniquely identifies the
            template message.
            """),
                            readonly=True,
                            required=True,
                            schema=IPOMsgID)

    msgid_plural = Object(
        title=u"The plural msgid for this message.",
        description=(u"Provides a plural msgid for the message. "
                     u"If it's not a plural form message, this value"
                     u"should be None."),
        required=True,
        readonly=True,
        schema=IPOMsgID)

    commenttext = Attribute("The manual comments this set has.")

    filereferences = Attribute("The files where this set appears.")

    sourcecomment = Attribute("The source code comments this set has.")

    flagscomment = Attribute("The flags this set has.")

    flags = Attribute("List of flags that apply to this message.")

    singular_text = Text(title=_("The singular text for this message."),
                         readonly=True)

    plural_text = Text(title=_("The plural text for this message or None."),
                       readonly=True)

    uses_english_msgids = Bool(title=_("Uses English strings as msgids"),
                               readonly=True,
                               description=_("""
            Some formats, such as Mozilla's XPI, use symbolic msgids where
            gettext uses the original English strings to identify messages.
            """))

    credits_message_ids = List(
        title=_("List of possible msgids for translation credits"),
        readonly=True,
        description=_("""
            This class attribute is intended to be used to construct database
            queries that search for credits messages.
            """))

    def clone():
        """Return a new copy of this POTMsgSet."""

    def getCurrentTranslationMessageOrDummy(pofile):
        """Return the current `TranslationMessage`, or a dummy.

        :param pofile: PO template you want a translation message for.
        :return: The current translation for `self` in `pofile`, if
            there is one.  Otherwise, a `DummyTranslationMessage` for
            `self` in `pofile`.
        """

    def getOtherTranslation(language, side):
        """Returns the TranslationMessage that is current on the other side.

        :param language: The language in which to find the message.
        :param side: The side from which this message is seen.
        """

    def getSharedTranslation(language, side):
        """Returns a shared TranslationMessage.

        :param language: The language in which to find the message.
        :param side: The side from which this message is seen.
        """

    def getLocalTranslationMessages(potemplate,
                                    language,
                                    include_dismissed=False,
                                    include_unreviewed=True):
        """Return all local unused translation messages for the POTMsgSet.

        Unused are those which are not current or imported, and local are
        those which are directly attached to this POTMsgSet.

        :param language: language we want translations for.
        :param include_dismissed: Also return those translation messages
          that have a creation date older than the review date of the current
          message (== have been dismissed).
        :param include_unreviewed: Also return those translation messages
          that have a creation date newer than the review date of the current
          message (== that are unreviewed). This is the default.
        """

    def getExternallyUsedTranslationMessages(language):
        """Find externally used translations for the same message.

        This is used to find suggestions for translating this
        `POTMsgSet` that are actually used (i.e. current or imported) in
        other templates.

        The suggestions are read-only; they come from the slave store.

        :param language: language we want translations for.
        """

    def getExternallySuggestedTranslationMessages(language):
        """Find externally suggested translations for the same message.

        This is used to find suggestions for translating this
        `POTMsgSet` that were entered in another context, but for the
        same English text, and are not in actual use.

        The suggestions are read-only; they come from the slave store.

        :param language: language we want translations for.
        """

    def getExternallySuggestedOrUsedTranslationMessages(
            suggested_languages=(), used_languages=()):
        """Find externally suggested/used translations for the same message.

        This returns a mapping: language -> namedtuple (suggested, used)
        containing the results of
        self.getExternallySuggestedTranslationMessages and
        self.getExternallyUsedTranslationMessages for each language.

        :param suggested_languages: languages we want suggestions for.
        :param used_languages: languges we want used messages for.
        """

    def hasTranslationChangedInLaunchpad(potemplate, language):
        """Whether an imported translation differs from the current one.

        :param potemplate: potemplate we are asking about.
        :param language: language for which translations we are asking about.

        There has to be an imported translation: if there isn't, this is
        not a 'changed' translation, just a 'new' translation in Launchpad.
        """

    def isTranslationNewerThan(pofile, timestamp):
        """Whether a current translation is newer than the `timestamp`.

        :param pofile: translation file for which translations we are asking
            about.
        :param timestamp: a timestamp we are comparing to.

        Returns True if there is a current and newer translation, and False
        otherwise.
        """

    def validateTranslations(translations):
        """Validate `translations` against gettext.

        :param translations: A dict mapping plural forms to translated
            strings.
        :raises GettextValidationError: if there is a problem with the
            translations.
        """

    def submitSuggestion(pofile,
                         submitter,
                         new_translations,
                         from_import=False):
        """Submit a suggested translation for this message.

        If an identical message is already present, it will be returned
        (and it is not changed).  Otherwise, a new one is created and
        returned.  Suggestions for translation credits messages are
        ignored, and None is returned in that case.
        Setting from_import to true will prevent karma assignment and
        set the origin of the created message to SCM instead of
        ROSETTAWEB.
        """

    def dismissAllSuggestions(pofile, reviewer, lock_timestamp):
        """Dismiss all suggestions for the given pofile.

        :param pofile: a `POFile` to dismiss suggestions from.
        :param reviewer: the person that is doing the dismissal.
        :param lock_timestamp: the timestamp when we checked the values we
            want to update.

        If a translation conflict is detected, TranslationConflict is raised.
        """

    def getCurrentTranslation(potemplate, language, side):
        """Get a current translation message.

        :param potemplate: An `IPOTemplate` to look up a translation for.
            If it's None, ignore diverged translations.
        :param language: translation should be to this `ILanguage`.
        :param side: translation side to look at.  (A `TranslationSide` value)
        """

    def setCurrentTranslation(pofile,
                              submitter,
                              translations,
                              origin,
                              share_with_other_side=False,
                              lock_timestamp=None):
        """Set the message's translation in Ubuntu, or upstream, or both.

        :param pofile: `POFile` you're setting translations in.  Other
            `POFiles` that share translations with this one may also be
            affected.
        :param submitter: `Person` who is setting these translations.
        :param translations: a dict mapping plural-form numbers to the
            translated string for that form.
        :param origin: A `RosettaTranslationOrigin`.
        :param share_with_other_side: When sharing this translation,
            share it with the other `TranslationSide` as well.
        :param lock_timestamp: Timestamp of the original translation state
            that this change is based on.
        """

    def resetCurrentTranslation(pofile,
                                lock_timestamp=None,
                                share_with_other_side=False):
        """Turn the current translation back into a suggestion.

        This deactivates the message's current translation.  The message
        becomes untranslated or, if it was diverged, reverts to its
        shared translation.

        The previously current translation becomes visible as a new
        suggestion again, as do all suggestions that came after it.

        :param pofile: The `POFile` to make the change in.
        :param lock_timestamp: Timestamp of the original translation state
            that this change is based on.
        :param share_with_other_side: Make the same change on the other
            translation side.
        """

    def clearCurrentTranslation(pofile,
                                submitter,
                                origin,
                                share_with_other_side=False,
                                lock_timestamp=None):
        """Set the current message in `pofile` to be untranslated.

        If the current message is shared, this will also clear it in
        other translations that share the same message.

        :param pofile: The translation file that should have its current
            translation for this `POTMsgSet` cleared.  If the message is
            shared, this may not be the only translation file that will
            be affected.
        :param submitter: The person responsible for clearing the message.
        :param origin: `RosettaTranslationOrigin`.
        :param share_with_other_side: If the current message is also
            current on the other side (i.e. the Ubuntu side if working
            upstream, or vice versa) then should it be cleared there as
            well?
        :param lock_timestamp: Timestamp of the original translation state
            that this change is based on.
        """

    hide_translations_from_anonymous = Attribute(
        """Whether the translations for this message should be hidden.

        Messages that are likely to contain email addresses
        are shown only to logged-in users, and not to anonymous users.
        """)

    is_translation_credit = Attribute(
        """Whether this is a message set for crediting translators.""")

    translation_credits_type = Choice(
        title=u"The type of translation credit of this message.",
        required=True,
        vocabulary=TranslationCreditsType)

    def makeHTMLID(suffix=None):
        """Unique name for this `POTMsgSet` for use in HTML element ids.

        The name is an underscore-separated sequence of:
         * the string 'msgset'
         * unpadded, numerical `id`
         * optional caller-supplied suffix.

        :param suffix: an optional suffix to be appended.  Must be suitable
            for use in HTML element ids.
        """

    def updatePluralForm(plural_form_text):
        """Update plural form text for this message.

        :param plural_form_text: Unicode string representing the plural form
            we want to store or None to unset current plural form.
        """

    def getSequence(potemplate):
        """Return the sequence number for this potmsgset in potemplate.

        :param potemplate: `IPOTemplate` where the sequence number applies.
        """

    def setSequence(potemplate, sequence):
        """Set the sequence number for this potmsgset in potemplate.

        :param potemplate: `IPOTemplate` where the sequence number applies.
        :param sequence: The sequence number of this `IPOTMsgSet` in the given
            `IPOTemplate`.
        """

    def setTranslationCreditsToTranslated(pofile):
        """Set the current translation for this translation credits message.

        Sets a fixed dummy string as the current translation, if this is a
        translation credits message, so that these get counted as
        'translated', too.
        Credits messages that already have a translation, imported messages
        and normal messages are left untouched.
        :param pofile: the POFile to set this translation in.
        """

    def getAllTranslationMessages():
        """Retrieve all `TranslationMessage`s for this `POTMsgSet`."""

    def getAllTranslationTemplateItems():
        """Retrieve all `TranslationTemplateItem`s for this `POTMsgSet`."""
class IPackageBuild(IBuildFarmJob):
    """Attributes and operations specific to package build jobs."""

    archive = exported(
        Reference(title=_('Archive'),
                  schema=IArchive,
                  required=True,
                  readonly=True,
                  description=_('The Archive context for this build.')))

    pocket = exported(
        Choice(title=_('Pocket'),
               required=True,
               vocabulary=PackagePublishingPocket,
               description=_('The build targeted pocket.')))

    upload_log = Object(
        schema=ILibraryFileAlias,
        required=False,
        title=_('The LibraryFileAlias containing the upload log for a'
                'build resulting in an upload that could not be processed '
                'successfully. Otherwise it will be None.'))

    upload_log_url = exported(
        TextLine(title=_("Upload Log URL"),
                 required=False,
                 description=_("A URL for failed upload logs."
                               "Will be None if there was no failure.")))

    current_component = Attribute(
        'Component where the source related to this build was last '
        'published.')

    distribution = exported(
        Reference(schema=IDistribution,
                  title=_("Distribution"),
                  required=True,
                  description=_("Shortcut for its distribution.")))

    distro_series = exported(
        Reference(schema=IDistroSeries,
                  title=_("Distribution series"),
                  required=True,
                  description=_("Shortcut for its distribution series.")))

    def estimateDuration():
        """Estimate the build duration."""

    def verifySuccessfulUpload():
        """Verify that the upload of this build completed succesfully."""

    def storeUploadLog(content):
        """Store the given content as the build upload_log.

        :param content: string containing the upload-processor log output for
            the binaries created in this build.
        """

    def notify(extra_info=None):
        """Notify current build state to related people via email.

        :param extra_info: Optional extra information that will be included
            in the notification email. If the notification is for a
            failed-to-upload error then this must be the content of the
            upload log.
        """

    def queueBuild(suspended=False):
        """Create a BuildQueue entry for this build.

        :param suspended: Whether the associated `Job` instance should be
            created in a suspended state.
        """

    def getUploader(changes):
        """Return the person responsible for the upload.
Example #24
0
class IVPOExport(Interface):
    """Shorthand of translation messages for efficient exports."""

    pofile = Object(title=u"Translation file",
                    required=True,
                    readonly=True,
                    schema=IPOFile)

    diverged = Text(
        title=u"Message divergence.",
        description=u"A POTemplate this is a divergence for, or None.",
        required=False,
        readonly=True)

    potmsgset = Object(title=u"See `IPOTMsgSet`.",
                       required=True,
                       readonly=True,
                       schema=IPOTMsgSet)

    sequence = Int(title=u"Message sequence number",
                   description=u"As in IPOTMsgSet.",
                   required=True,
                   readonly=True)

    comment = Text(title=u"Comment for translated message",
                   description=u"Same as IPOTMsgSet.commenttext.",
                   required=False,
                   readonly=True)

    source_comment = Text(title=u"Comment for original message",
                          description=u"Same as IPOTMsgSet.sourcecomment.",
                          required=False,
                          readonly=True)

    file_references = Text(title=u"Message's source location",
                           description=u"Same as IPOTMsgSet.filereferences.",
                           required=False,
                           readonly=True)

    flags_comment = Text(title=u"Message flags",
                         description=u"Same as IPOTMsgSet.flagscomment.",
                         required=False,
                         readonly=True)

    context = Text(title=u"Message context",
                   description=u"As in IPOTMsgSet.",
                   readonly=True,
                   required=False)

    msgid_singular = Text(title=u"Message identifier (singular)",
                          description=u"See IPOMsgID.pomsgid.",
                          required=True,
                          readonly=True)

    msgid_plural = Text(title=u"Message identifier (plural)",
                        description=u"See IPOMsgID.pomsgid.",
                        required=False,
                        readonly=True)

    is_current_ubuntu = Bool(
        title=_("Whether this message is currently used in Launchpad"),
        description=u"As in ITranslationMessage.",
        readonly=True,
        required=True)

    is_current_upstream = Bool(title=_("Whether this message was imported"),
                               description=u"As in ITranslationMessage.",
                               readonly=True,
                               required=True)

    assert TranslationConstants.MAX_PLURAL_FORMS == 6, (
        "Change this code to support %d plural forms." %
        TranslationConstants.MAX_PLURAL_FORMS)

    translation0 = Text(title=u"Translation in plural form 0",
                        description=u"As in ITranslationMessage.",
                        readonly=True,
                        required=False)

    translation1 = Text(title=u"Translation in plural form 1",
                        description=u"As in ITranslationMessage.",
                        readonly=True,
                        required=False)

    translation2 = Text(title=u"Translation in plural form 2",
                        description=u"As in ITranslationMessage.",
                        readonly=True,
                        required=False)

    translation3 = Text(title=u"Translation in plural form 3",
                        description=u"As in ITranslationMessage.",
                        readonly=True,
                        required=False)

    translation4 = Text(title=u"Translation in plural form 4",
                        description=u"As in ITranslationMessage.",
                        readonly=True,
                        required=False)

    translation5 = Text(title=u"Translation in plural form 5",
                        description=u"As in ITranslationMessage.",
                        readonly=True,
                        required=False)
class IOpenIdIdentifier(Interface):
    """An OpenId Identifier that can be used to log into an Account"""
    account = Object(schema=IAccount, required=True)
    identifier = TextLine(title=_("OpenId Identity"), required=True)
    date_created = Datetime(
        title=_("Date Created"), required=True, readonly=True)
Example #26
0
 class IMyObject(Interface):
     """Object interface"""
     subobject = Object(title='my object', schema=IMySubObject)
     name = TextLine(title='name')
Example #27
0
 class IMiddleThing(interface.Interface):
     nested = Object(INestedThing)
Example #28
0
 class IObjectWidgetSingleIntegration(Interface):
     """Single integration interface"""
     subobj = Object(title=OBJECT_LABEL,
                     schema=IObjectWidgetSingleSubIntegration)
Example #29
0
 class IRoot(interface.Interface):
     field = Object(IMiddleThing)
class IBinaryPackageRelease(Interface):
    id = Int(title=_('ID'), required=True)
    binarypackagename = Int(required=True)
    binarypackagenameID = Int(required=True)
    version = TextLine(required=True, constraint=valid_debian_version)
    summary = Text(required=True)
    description = Text(required=True)
    build = Int(required=True)
    binpackageformat = Int(required=True)
    component = Int(required=True)
    section = Int(required=True)
    priority = Int(required=False)
    shlibdeps = TextLine(required=False)
    depends = TextLine(required=False)
    recommends = TextLine(required=False)
    suggests = TextLine(required=False)
    conflicts = TextLine(required=False)
    replaces = TextLine(required=False)
    provides = TextLine(required=False)
    pre_depends = TextLine(required=False)
    enhances = TextLine(required=False)
    breaks = TextLine(required=False)
    essential = Bool(required=False)
    installedsize = Int(required=False)
    architecturespecific = Bool(required=True)
    datecreated = Datetime(required=True, readonly=True)
    debug_package = Object(
        title=_("Debug package"),
        schema=Interface,
        required=False,
        description=_("The corresponding package containing debug symbols "
                      "for this binary."))
    user_defined_fields = List(
        title=_("Sequence of user-defined fields as key-value pairs."))

    homepage = TextLine(
        title=_("Homepage"),
        description=_(
            "Upstream project homepage as set in the package. This URL is not "
            "sanitized."),
        required=False)

    files = Attribute("Related list of IBinaryPackageFile entries")

    title = TextLine(required=True, readonly=True)
    name = Attribute("Binary Package Name")
    sourcepackagename = Attribute(
        "The name of the source package from where this binary was built.")

    # Properties.
    distributionsourcepackagerelease = Attribute(
        "The sourcepackage release in this distribution from which this "
        "binary was built.")

    is_new = Bool(title=_("New Binary."),
                  description=_(
                      "True if there binary version was never published for "
                      "the architeture it was built for. False otherwise."))

    # This is a dictionary for fast retrieval over the webservice.
    properties = Dict(title=_("The properties of this binary."))

    def addFile(file):
        """Create a BinaryPackageFile record referencing this build
        and attach the provided library file alias (file).
        """

    def override(component=None, section=None, priority=None):
        """Uniform method to override binarypackagerelease attribute.
Example #31
0
 def __init__(self, schema=ITerm, **kw):
     Object.__init__(self, schema, **kw)