Ejemplo n.º 1
0
class IBugAddForm(IBug):
    """Information we need to create a bug"""
    id = Int(title=_("Bug #"), required=False)
    product = Choice(title=_("Project"),
                     required=False,
                     description=_("""The thing you found this bug in,
            which was installed by something other than apt-get, rpm,
            emerge or similar"""),
                     vocabulary="Product")
    packagename = Choice(title=_("Package Name"),
                         required=False,
                         description=_("""The package you found this bug in,
            which was installed via apt-get, rpm, emerge or similar."""),
                         vocabulary="BinaryAndSourcePackageName")
    title = Title(title=_('Summary'), required=True)
    distribution = Choice(
        title=_("Linux Distribution"),
        required=True,
        description=_("Ubuntu, Debian, Gentoo, etc. You can file bugs only on "
                      "distrubutions using Launchpad as their primary bug "
                      "tracker."),
        vocabulary="DistributionUsingMalone")
    owner = Int(title=_("Owner"), required=True)
    comment = Description(title=_('Further information'),
                          strip_text=True,
                          trailing_only=True,
                          min_length=1,
                          max_length=50000,
                          required=False)
    bug_already_reported_as = Choice(
        title=_("This bug has already been reported as ..."),
        required=False,
        vocabulary="Bug")
    filecontent = Bytes(title=u"Attachment",
                        required=False,
                        constraint=attachment_size_constraint)
    patch = Bool(title=u"This attachment is a patch",
                 required=False,
                 default=False)
    attachment_description = Title(title=u'Description', required=False)
    status = Choice(title=_('Status'),
                    values=list(item for item in BugTaskStatus.items.items
                                if item != BugTaskStatus.UNKNOWN),
                    default=IBugTask['status'].default)
    importance = Choice(title=_('Importance'),
                        values=list(item
                                    for item in BugTaskImportance.items.items
                                    if item != BugTaskImportance.UNKNOWN),
                        default=IBugTask['importance'].default)
    milestone = Choice(title=_('Milestone'),
                       required=False,
                       vocabulary='Milestone')
    assignee = PublicPersonChoice(title=_('Assign to'),
                                  required=False,
                                  vocabulary='ValidAssignee')
    subscribe_to_existing_bug = Choice(title=u'Subscribe to this bug',
                                       vocabulary=SUBSCRIBE_TO_BUG_VOCABULARY,
                                       required=True,
                                       default=False)
Ejemplo n.º 2
0
class IFAQPublic(IHasOwner):

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

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

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

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

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

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

    date_last_updated = exported(Datetime(title=_('Last Updated'),
                                          required=False,
                                          readonly=True),
                                 as_of='devel')

    target = exported(Reference(
        title=_('Target'),
        description=_('Product or distribution containing this FAQ.'),
        schema=IFAQTarget,
        required=True,
        readonly=True),
                      as_of='devel')

    related_questions = Attribute(
        _('The set of questions linked to this FAQ.'))
Ejemplo n.º 3
0
class AddAnnouncementForm(Interface):
    """Form definition for the view which creates new Announcements."""

    title = Title(title=_('Headline'), required=True)
    summary = Summary(title=_('Summary'), required=True)
    url = TextLine(title=_('URL'),
                   required=False,
                   constraint=valid_webref,
                   description=_("The web location of your announcement."))
    publication_date = AnnouncementDate(title=_('Date'), required=True)
Ejemplo n.º 4
0
class IBugMessageAddForm(Interface):
    """Schema used to build the add form for bug comment/attachment."""

    subject = Title(title=u"Subject", required=True)
    comment = Text(title=u"Comment", required=False)
    filecontent = Bytes(
        title=u"Attachment", required=False,
        constraint=attachment_size_constraint)
    patch = Bool(
        title=u"This attachment contains a solution (patch) for this bug",
        required=False, default=False)
    attachment_description = Title(title=u'Description', required=False)
    email_me = Bool(
        title=u"E-mail me about changes to this bug report",
        required=False, default=False)
    bugwatch_id = Int(
        title=(u"Synchronize this comment with a remote bug "
               "tracker using the bug watch with this id."),
        required=False, default=None)
Ejemplo n.º 5
0
class IFAQ(IHasOwner):
    """A document containing the answer to a commonly asked question.

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

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

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

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

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

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

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

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

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

    related_questions = Attribute(
        _('The set of questions linked to this FAQ.'))
Ejemplo n.º 6
0
class ISnappyDistroSeries(Interface):
    """A snappy/distro series link."""

    snappy_series = Reference(ISnappySeries,
                              title=_("Snappy series"),
                              readonly=True)
    distro_series = Reference(IDistroSeries,
                              title=_("Distro series"),
                              required=False,
                              readonly=True)
    preferred = Bool(
        title=_("Preferred"),
        required=True,
        readonly=False,
        description=_(
            "True if this identifies the default distro series for builds "
            "for this snappy series."))

    title = Title(title=_("Title"), required=True, readonly=True)
Ejemplo n.º 7
0
class ISnappySeriesEditableAttributes(Interface):
    """`ISnappySeries` attributes that can be edited.

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

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

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

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

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

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

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

    can_infer_distro_series = exported(
        Bool(title=_("Can infer distro series?"),
             required=True,
             readonly=False,
             description=_(
                 "True if inferring a distro series from snapcraft.yaml is "
                 "supported for this snappy series.")))
Ejemplo n.º 8
0
class ICountry(Interface):
    """The country description."""
    export_as_webservice_entry(plural_name='countries', publish_web_link=False)

    id = Int(
        title=_('Country ID'),
        required=True,
        readonly=True,
    )
    iso3166code2 = exported(
        TextLine(title=_('iso3166code2'), required=True, readonly=True))
    iso3166code3 = exported(
        TextLine(title=_('iso3166code3'), required=True, readonly=True))
    name = exported(
        TextLine(title=_('Country name'), required=True,
                 constraint=valid_name))
    title = exported(Title(title=_('Country title'), required=True))
    description = exported(Description(title=_('Description'), required=True))

    continent = Attribute("The Continent where this country is located.")
    languages = Attribute("An iterator over languages that are spoken in "
                          "that country.")
Ejemplo n.º 9
0
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))
    display_name = exported(TextLine(title=_("Display name"),
                                     required=True,
                                     description=_("The series displayname.")),
                            exported_as="displayname")
    displayname = Attribute("Display name (deprecated)")
    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=_("Email changes to"),
                 required=True,
                 description=_("The mailing list or other email 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 = exported(
        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.""")))

    index_compressors = exported(
        List(value_type=Choice(vocabulary=IndexCompressionType),
             title=_("Compression types to use for published index files"),
             required=True,
             description=_("""
            A list of compression types to use for published index files
            (Packages, Sources, etc.).""")))

    publish_by_hash = exported(
        Bool(title=_("Publish by-hash directories"),
             required=True,
             description=_("""
            Publish archive index files in by-hash directories so that apt
            can retrieve them based on their hash, avoiding race conditions
            between InRelease and other files during mirror updates.""")))

    advertise_by_hash = exported(
        Bool(title=_("Advertise by-hash directories"),
             required=True,
             description=_("""
            Advertise by-hash directories with a flag in the Release file so
            that apt uses them by default.  Only effective if
            publish_by_hash is also set.""")))

    strict_supported_component_dependencies = exported(Bool(
        title=_("Strict dependencies of supported components"),
        required=True,
        description=_("""
            If True, packages in supported components (main and restricted)
            may not build-depend on packages in unsupported components.  Do
            not rely on the name of this attribute, even for reading; it is
            currently subject to change.""")),
                                                       as_of="devel")

    inherit_overrides_from_parents = Bool(
        title=_("Inherit overrides from parents"),
        readonly=False,
        required=True)

    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
        IDistributionSourcePackageRelease 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(
            vocabulary=PackageUploadStatus,
            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(
            vocabulary=PackagePublishingPocket,
            title=_("Pocket"),
            description=_("Return only items targeted to this pocket"),
            required=False),
        custom_type=Choice(vocabulary=PackageUploadCustomFormat,
                           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 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 `IDistributionSourcePackageRelease`.
        """

    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,
                                           buildinfo=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
         :param buildinfo: optional LFA with build information file
         :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, enabled=True):
        """Create a new port or DistroArchSeries for this DistroSeries."""

    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=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=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.
Ejemplo n.º 10
0
class IBugView(Interface):
    """IBug attributes that require launchpad.View permission."""

    name = exported(
        BugNameField(title=_('Nickname'),
                     required=False,
                     description=_("""A short and unique name.
                Add one only if you often need to retype the URL
                but have trouble remembering the bug number."""),
                     constraint=bug_name_validator))
    title = exported(
        Title(title=_('Summary'),
              required=True,
              description=_("""A one-line summary of the problem.""")))
    description = exported(
        Description(title=_('Description'),
                    required=True,
                    description=_("""A detailed description of the problem,
                 including the steps required to reproduce it."""),
                    strip_text=True,
                    trailing_only=True,
                    min_length=1,
                    max_length=50000))
    ownerID = Int(title=_('Owner'), required=True, readonly=True)
    owner = exported(
        Reference(IPerson, title=_("The owner's IPerson"), readonly=True))
    bugtasks = exported(CollectionField(title=_(
        'BugTasks on this bug, sorted upstream, then '
        'by ubuntu, then by other distroseries.'),
                                        value_type=Reference(schema=IBugTask),
                                        readonly=True),
                        exported_as='bug_tasks')
    default_bugtask = Reference(
        title=_("The first bug task to have been filed."), schema=IBugTask)
    duplicateof = exported(DuplicateBug(title=_('Duplicate Of'),
                                        required=False,
                                        readonly=True),
                           exported_as='duplicate_of')
    datecreated = exported(Datetime(title=_('Date Created'),
                                    required=True,
                                    readonly=True),
                           exported_as='date_created')
    displayname = TextLine(title=_("Text of the form 'Bug #X"), readonly=True)
    activity = exported(
        doNotSnapshot(
            CollectionField(
                title=_('Log of activity that has occurred on this bug.'),
                value_type=Reference(schema=IBugActivity),
                readonly=True)))
    affected_pillars = Attribute(
        'The "pillars", products or distributions, affected by this bug.')
    permits_expiration = Bool(
        title=_("Does the bug's state permit expiration?"),
        description=_(
            "Expiration is permitted when the bug is not valid anywhere, "
            "a message was sent to the bug reporter, and the bug is "
            "associated with pillars that have enabled bug expiration."),
        readonly=True)
    can_expire = exported(Bool(title=_(
        "Can the Incomplete bug expire? "
        "Expiration may happen when the bug permits expiration, "
        "and a bugtask cannot be confirmed."),
                               readonly=True), ('devel', dict(exported=False)),
                          exported=True)
    subscriptions = exported(
        doNotSnapshot(
            CollectionField(title=_('Subscriptions'),
                            value_type=Reference(schema=Interface),
                            readonly=True)))
    date_last_updated = exported(
        Datetime(title=_('Date Last Updated'), required=True, readonly=True))
    is_complete = Bool(
        title=_("Is Complete?"),
        description=_(
            "True or False depending on whether this bug is considered "
            "completely addressed. A bug in Launchpad is completely "
            "addressed when there are no tasks that are still open for "
            "the bug."),
        readonly=True)
    official_tags = Attribute("The official bug tags relevant to this bug.")
    who_made_private = exported(
        PublicPersonChoice(
            title=_('Who Made Private'),
            required=False,
            vocabulary='ValidPersonOrTeam',
            description=_("The person who set this bug private."),
            readonly=True))
    date_made_private = exported(
        Datetime(title=_('Date Made Private'), required=False, readonly=True))
    heat = exported(
        Int(title=_("The 'heat' of the bug"), required=False, readonly=True))
    watches = exported(CollectionField(
        title=_("All bug watches associated with this bug."),
        value_type=Object(schema=IBugWatch),
        readonly=True),
                       exported_as='bug_watches')
    cves = exported(
        CollectionField(title=_('CVE entries related to this bug.'),
                        value_type=Reference(schema=ICve),
                        readonly=True))
    has_cves = Bool(title=u"True if the bug has cve entries.")
    cve_links = Attribute('Links between this bug and CVE entries.')
    duplicates = exported(
        CollectionField(
            title=_("MultiJoin of bugs which are dupes of this one."),
            value_type=BugField(),
            readonly=True))
    # See lp.bugs.model.bug.Bug.attachments for why there are two similar
    # properties here.
    # attachments_unpopulated would more naturally be attachments, and
    # attachments be attachments_prepopulated, but lazr.resful cannot
    # export over a non-exported attribute in an interface.
    # https://bugs.launchpad.net/lazr.restful/+bug/625102
    attachments_unpopulated = CollectionField(
        title=_("List of bug attachments."),
        value_type=Reference(schema=IBugAttachment),
        readonly=True)
    attachments = doNotSnapshot(
        exported(
            CollectionField(title=_("List of bug attachments."),
                            value_type=Reference(schema=IBugAttachment),
                            readonly=True)))
    security_related = exported(
        Bool(title=_("This bug is a security vulnerability."),
             required=False,
             readonly=True))
    has_patches = Attribute("Does this bug have any patches?")
    latest_patch_uploaded = exported(
        Datetime(title=_('Date when the most recent patch was uploaded.'),
                 required=False,
                 readonly=True))
    latest_patch = Attribute("The most recent patch of this bug.")
    initial_message = Attribute(
        "The message that was specified when creating the bug")
    questions = Attribute("List of questions related to this bug.")
    specifications = Attribute("List of related specifications.")
    tags = exported(
        List(title=_("Tags"),
             description=_("Space-separated keywords for classifying "
                           "this bug report."),
             value_type=Tag(),
             required=False))
    messages = doNotSnapshot(
        CollectionField(title=_(
            "The messages related to this object, in reverse "
            "order of creation (so newest first)."),
                        readonly=True,
                        value_type=Reference(schema=IMessage)))
    followup_subject = Attribute("The likely subject of the next message.")
    date_last_message = exported(
        Datetime(title=_("Date of last bug message"),
                 required=False,
                 readonly=True))
    number_of_duplicates = exported(
        Int(title=_('The number of bugs marked as duplicates of this bug'),
            required=True,
            readonly=True))
    message_count = exported(
        Int(title=_('The number of comments on this bug'),
            required=True,
            readonly=True))
    users_affected_count = exported(
        Int(title=_('The number of users affected by this bug '
                    '(not including duplicates)'),
            required=True,
            readonly=True))
    users_unaffected_count = exported(
        # We don't say "(not including duplicates)" here because
        # affected and unaffected are asymmetrical that way.  If a dup
        # affects you, then the master bug affects you; but if a dup
        # *doesn't* affect you, the master bug may or may not affect
        # you, since a dup is often a specific symptom of a more
        # general master bug.
        Int(title=_('The number of users unaffected by this bug'),
            required=True,
            readonly=True))
    users_affected = exported(
        doNotSnapshot(
            CollectionField(title=_('The number of users affected by this bug '
                                    '(not including duplicates)'),
                            value_type=Reference(schema=IPerson),
                            readonly=True)))
    users_unaffected = exported(
        doNotSnapshot(
            CollectionField(title=_('Users explicitly marked as unaffected '
                                    '(not including duplicates)'),
                            value_type=Reference(schema=IPerson),
                            readonly=True)))
    users_affected_count_with_dupes = exported(
        Int(title=_('The number of users affected by this bug '
                    '(including duplicates)'),
            required=True,
            readonly=True))
    other_users_affected_count_with_dupes = exported(
        Int(title=_('The number of users affected by this bug '
                    '(including duplicates), excluding the current user'),
            required=True,
            readonly=True))
    users_affected_with_dupes = exported(
        doNotSnapshot(
            CollectionField(title=_('Users affected (including duplicates)'),
                            value_type=Reference(schema=IPerson),
                            readonly=True)))
    # Adding related BugMessages provides a hook for getting at
    # BugMessage.message.visible when building bug comments.
    bug_messages = Attribute('The bug messages related to this object.')
    comment_count = Attribute(
        "The number of comments on this bug, not including the initial "
        "comment.")
    indexed_messages = doNotSnapshot(
        exported(CollectionField(title=_(
            "The messages related to this object, in reverse "
            "order of creation (so newest first)."),
                                 readonly=True,
                                 value_type=Reference(schema=IMessage)),
                 exported_as='messages'))

    def getSpecifications(user):
        """List of related specifications that the user can view."""

    def _indexed_messages(include_content=False, include_parents=False):
        """Low level query for getting bug messages.

        :param include_content: If True retrieve the content for the messages
            too.
        :param include_parents: If True retrieve the object for parent
            messages too. If False the parent attribute will be *forced* to
            None to prevent lazy evaluation triggering database lookups.
        """

    def hasBranch(branch):
        """Is this branch linked to this bug?"""

    def isSubscribed(person):
        """Is person subscribed to this bug?

        Returns True if the user is explicitly subscribed to this bug
        (no matter what the type of subscription), otherwise False.

        If person is None, the return value is always False.
        """

    def isSubscribedToDupes(person):
        """Is person directly subscribed to dupes of this bug?

        Returns True if the user is directly subscribed to at least one
        duplicate of this bug, otherwise False.
        """

    def isMuted(person):
        """Does person have a muted subscription on this bug?

        :returns: True if the user has muted all email from this bug.
        """

    def getDirectSubscriptions():
        """A sequence of IBugSubscriptions directly linked to this bug."""

    def getDirectSubscribers(recipients=None, level=None):
        """A list of IPersons that are directly subscribed to this bug.

        Direct subscribers have an entry in the BugSubscription table.
        """

    def getDirectSubscribersWithDetails():
        """Get direct subscribers and their subscriptions for the bug.

        Those with muted bug subscriptions are excluded from results.

        :returns: A ResultSet of tuples (Person, BugSubscription)
            representing a subscriber and their bug subscription.
        """

    def getIndirectSubscribers(recipients=None, level=None):
        """Return IPersons that are indirectly subscribed to this bug.

        Indirect subscribers get bugmail, but don't have an entry in the
        BugSubscription table. This subscribers from dupes, etc.
        """

    def getAlsoNotifiedSubscribers(recipients=None, level=None):
        """Return IPersons in the "Also notified" subscriber list.

        This includes assignees, but not subscribers from duplicates.
        """

    def getSubscriptionsFromDuplicates():
        """Return IBugSubscriptions subscribed from dupes of this bug."""

    def getSubscribersFromDuplicates():
        """Return IPersons subscribed from dupes of this bug."""

    def getSubscribersForPerson(person):
        """Find the persons or teams by which person is subscribed.

        This call should be quite cheap to make and performs a single query.

        :return: An IResultSet.
        """

    def getSubscriptionForPerson(person):
        """Return the `BugSubscription` for a `Person` to this `Bug`.

        If no such `BugSubscription` exists, return None.
        """

    def getSubscriptionInfo(level=None):
        """Return a `BugSubscriptionInfo` at the given `level`.

        :param level: A member of `BugNotificationLevel`. Defaults to
            `BugSubscriptionLevel.LIFECYCLE` if unspecified.
        """

    def getBugNotificationRecipients(level=BugNotificationLevel.LIFECYCLE):
        """Return a complete INotificationRecipientSet instance.

        The INotificationRecipientSet instance will contain details of
        all recipients for bug notifications sent by this bug; this
        includes email addresses and textual and header-ready
        rationales. See `BugNotificationRecipients` for
        details of this implementation.
        """

    def clearBugNotificationRecipientsCache():
        """Clear the bug notification recipient BugNotificationLevel cache.

        Call this when a change to a bug or bugtask would change the
        notification recipients. Changing a a bugtask's milestone or
        target is such a case.
        """

    def canBeAQuestion():
        """Return True of False if a question can be created from this bug.

        A Question can be created from a bug if:
        1. There is only one bugtask with a status of New, Incomplete,
           Confirmed, or Wont Fix. Any other bugtasks must be Invalid.
        2. The bugtask's target uses Launchpad to track bugs.
        3. The bug was not made into a question previously.
        """

    def getQuestionCreatedFromBug():
        """Return the question created from this Bug, or None."""

    def getMessagesForView(slice_info):
        """Return BugMessage,Message,MessageChunks for renderinger.

        This eager loads message.owner validity associated with the
        bugmessages.

        :param slice_info: Either None or a list of slices to constraint the
            returned rows. The step parameter in each slice is ignored.
        """

    @operation_parameters(target=Reference(schema=Interface,
                                           title=_('Target')))
    @export_read_operation()
    def canBeNominatedFor(target):
        """Can this bug nominated for this target?

        :nomination_target: An IDistroSeries or IProductSeries.

        Returns True or False.
        """

    @operation_parameters(target=Reference(schema=Interface,
                                           title=_('Target')))
    @operation_returns_entry(Interface)
    @export_read_operation()
    def getNominationFor(target):
        """Return the IBugNomination for the target.

        If no nomination is found, a NotFoundError is raised.

        :param nomination_target: An IDistroSeries or IProductSeries.
        """

    @operation_parameters(
        target=Reference(schema=Interface, title=_('Target'), required=False),
        nominations=List(
            title=_("Nominations to search through."),
            value_type=Reference(schema=Interface),  # IBugNomination
            required=False))
    @operation_returns_collection_of(Interface)  # IBugNomination
    @export_read_operation()
    def getNominations(target=None, nominations=None):
        """Return a list of all IBugNominations for this bug.

        The list is ordered by IBugNominations.target.bugtargetdisplayname.

        :param target: An IProduct or IDistribution. Only nominations
            for this target are returned.
        :param nominations: The list of nominations to search through.
            If none is given, the bug's nominations are looked through.
            This can be useful when having to call this method multiple
            times, to avoid getting the list of nominations each time.
        """

    def getBugWatch(bugtracker, remote_bug):
        """Return the BugWatch that has the given bugtracker and remote bug.

        Return None if this bug doesn't have such a bug watch.
        """

    def getBugTask(target):
        """Return the bugtask with the specified target.

        Return None if no such bugtask is found.
        """

    def getBugTasksByPackageName(bugtasks):
        """Return a mapping from `ISourcePackageName` to its bug tasks.

        This mapping is suitable to pass as the bugtasks_by_package
        cache to getConjoinedMaster().

        The mapping is from a `ISourcePackageName` to all the bug tasks
        that are targeted to such a package name, no matter which
        distribution or distro series it is.

        All the tasks that don't have a package will be available under
        None.
        """

    @call_with(user=REQUEST_USER)
    @export_write_operation()
    def isUserAffected(user):
        """Is :user: marked as affected by this bug?"""

    def userCanSetCommentVisibility(user):
        """Return True if `user` can set bug comment visibility.

        This method is called by security adapters for authenticated users.

        Users who can set bug comment visibility are:
        - Admins and registry admins
        - users in project roles on any bugtask:
          - maintainer
          - driver
          - bug supervisor

        Additionally, the comment owners can hide their own comments but that
        is not checked here - this method is to see if arbitrary users can
        hide comments they did not make themselves.

        """

    @call_with(user=REQUEST_USER)
    @operation_returns_collection_of(Interface)
    @export_read_operation()
    def getHWSubmissions(user=None):
        """Return HWDB submissions linked to this bug.

        :return: A sequence of HWDB submissions linked to this bug.
        :param user: The user making the request.

        Only those submissions are returned which the user can access.
        Public submissions are always included; private submisisons only
        if the user is the owner or an admin.
        """

    @operation_parameters(days_old=Int(
        title=_('Number of days of inactivity for which to check.'),
        required=False))
    @export_read_operation()
    def isExpirable(days_old=None):
        """Is this bug eligible for expiration and was it last updated
        more than X days ago?

        If days_old is None the default number of days without activity
        is used.

        Returns True or False.
        """

    def getActivityForDateRange(start_date, end_date):
        """Return all the `IBugActivity` for this bug in a date range.

        :param start_date: The earliest date for which activity can be
            returned.
        :param end_date: The latest date for which activity can be
            returned.
        """

    def shouldConfirmBugtasks():
        """Should we try to confirm this bug's bugtasks?

        Return True if more than one user is affected."""

    def maybeConfirmBugtasks():
        """Maybe try to confirm our new bugtasks."""

    def personIsDirectSubscriber(person):
        """Return True if the person is a direct subscriber to this `IBug`.

        Otherwise, return False.
        """

    def personIsAlsoNotifiedSubscriber(person):
        """Return True if the person is an indirect subscriber to this `IBug`.

        Otherwise, return False.
        """

    def personIsSubscribedToDuplicate(person):
        """Return True if the person subscribed to a duplicate of this `IBug`.

        Otherwise, return False.
        """

    def getAllowedInformationTypes(user):
        """Get a list of acceptable `InformationType`s for this bug.
Ejemplo n.º 11
0
class ISpecificationView(IHasOwner, IHasLinkedBranches):
    """Specification's attributes and methods that require
    the permission launchpad.LimitedView.
    """

    name = exported(SpecNameField(
        title=_('Name'),
        required=True,
        readonly=False,
        description=_(
            "May contain lower-case letters, numbers, and dashes. "
            "It will be used in the specification url. "
            "Examples: mozilla-type-ahead-find, postgres-smart-serial.")),
                    as_of="devel")
    title = exported(Title(
        title=_('Title'),
        required=True,
        description=_(
            "Describe the feature as clearly as possible in up to 70 "
            "characters. This title is displayed in every feature "
            "list or report.")),
                     as_of="devel")
    specurl = exported(
        SpecURLField(
            title=_('Specification URL'),
            required=False,
            description=_(
                "The URL of the specification. This is usually a wiki page."),
            constraint=valid_webref),
        exported_as="specification_url",
        as_of="devel",
    )
    summary = exported(Summary(
        title=_('Summary'),
        required=True,
        description=_(
            "A single-paragraph description of the feature. "
            "This will also be displayed in most feature listings.")),
                       as_of="devel")

    definition_status = exported(Choice(
        title=_('Definition Status'),
        readonly=True,
        vocabulary=SpecificationDefinitionStatus,
        default=SpecificationDefinitionStatus.NEW,
        description=_(
            "The current status of the process to define the "
            "feature and get approval for the implementation plan.")),
                                 as_of="devel")

    assignee = exported(PublicPersonChoice(
        title=_('Assignee'),
        required=False,
        description=_("The person responsible for implementing the feature."),
        vocabulary='ValidPersonOrTeam'),
                        as_of="devel")
    assigneeID = Attribute('db assignee value')
    drafter = exported(PublicPersonChoice(
        title=_('Drafter'),
        required=False,
        description=_(
            "The person responsible for drafting the specification."),
        vocabulary='ValidPersonOrTeam'),
                       as_of="devel")
    drafterID = Attribute('db drafter value')
    approver = exported(PublicPersonChoice(
        title=_('Approver'),
        required=False,
        description=_(
            "The person responsible for approving the specification, "
            "and for reviewing the code when it's ready to be landed."),
        vocabulary='ValidPersonOrTeam'),
                        as_of="devel")
    approverID = Attribute('db approver value')

    priority = exported(Choice(title=_('Priority'),
                               vocabulary=SpecificationPriority,
                               default=SpecificationPriority.UNDEFINED,
                               required=True),
                        as_of="devel")
    datecreated = exported(
        Datetime(title=_('Date Created'), required=True, readonly=True),
        as_of="devel",
        exported_as="date_created",
    )
    owner = exported(PublicPersonChoice(title=_('Owner'),
                                        required=True,
                                        readonly=True,
                                        vocabulary='ValidPersonOrTeam'),
                     as_of="devel")

    product = Choice(title=_('Project'), required=False, vocabulary='Product')
    distribution = Choice(title=_('Distribution'),
                          required=False,
                          vocabulary='Distribution')

    # Exported as readonly for simplicity, but could be exported as read-write
    # using setTarget() as the mutator.
    target = exported(
        ReferenceChoice(
            title=_('For'),
            required=True,
            vocabulary='DistributionOrProduct',
            description=_(
                "The project for which this proposal is being made."),
            schema=ISpecificationTarget),
        as_of="devel",
        readonly=True,
    )

    productseries = Choice(
        title=_('Series Goal'),
        required=False,
        vocabulary='FilteredProductSeries',
        description=_(
            "Choose a series in which you would like to deliver this "
            "feature. Selecting '(nothing selected)' will clear the goal."))
    distroseries = Choice(
        title=_('Series Goal'),
        required=False,
        vocabulary='FilteredDistroSeries',
        description=_(
            "Choose a series in which you would like to deliver this "
            "feature. Selecting '(nothing selected)' will clear the goal."))

    # milestone
    milestone = exported(ReferenceChoice(
        title=_('Milestone'),
        required=False,
        vocabulary='Milestone',
        description=_(
            "The milestone in which we would like this feature to be "
            "delivered."),
        schema=IMilestone),
                         as_of="devel")

    # nomination to a series for release management
    # XXX: It'd be nice to export goal as read-only, but it's tricky because
    # users will need to be aware of goalstatus as what's returned by .goal
    # may not be the accepted goal.
    goal = Attribute("The series for which this feature is a goal.")
    goalstatus = Choice(
        title=_('Goal Acceptance'),
        vocabulary=SpecificationGoalStatus,
        default=SpecificationGoalStatus.PROPOSED,
        description=_(
            "Whether or not the drivers have accepted this feature as "
            "a goal for the targeted series."))
    goal_proposer = Attribute("The person who nominated the spec for "
                              "this series.")
    date_goal_proposed = Attribute("The date of the nomination.")
    goal_decider = Attribute("The person who approved or declined "
                             "the spec a a goal.")
    date_goal_decided = Attribute("The date the spec was approved "
                                  "or declined as a goal.")

    work_items = List(description=_(
        "All non-deleted work items for this spec, sorted by "
        "their 'sequence'"),
                      value_type=Reference(schema=ISpecificationWorkItem),
                      readonly=True)
    whiteboard = exported(Text(
        title=_('Status Whiteboard'),
        required=False,
        description=_("Any notes on the status of this spec you would like to "
                      "make. Your changes will override the current text.")),
                          as_of="devel")
    workitems_text = exported(WorkItemsText(
        title=_('Work Items'),
        required=False,
        readonly=True,
        description=_(
            "Work items for this specification input in a text format. "
            "Your changes will override the current work items.")),
                              as_of="devel")
    direction_approved = exported(Bool(
        title=_('Basic direction approved?'),
        required=True,
        default=False,
        description=_("Check this to indicate that the drafter and assignee "
                      "have satisfied the approver that they are headed in "
                      "the right basic direction with this specification.")),
                                  as_of="devel")
    man_days = Int(
        title=_("Estimated Developer Days"),
        required=False,
        default=None,
        description=_(
            "An estimate of the "
            "number of developer days it will take to implement this feature. "
            "Please only provide an estimate if you are relatively confident "
            "in the number."))
    implementation_status = exported(Choice(
        title=_("Implementation Status"),
        required=True,
        readonly=True,
        default=SpecificationImplementationStatus.UNKNOWN,
        vocabulary=SpecificationImplementationStatus,
        description=_("The state of progress being made on the actual "
                      "implementation or delivery of this feature.")),
                                     as_of="devel")
    superseded_by = Choice(
        title=_("Superseded by"),
        required=False,
        default=None,
        vocabulary='Specification',
        description=_(
            "The specification "
            "which supersedes this one. Note that selecting a specification "
            "here and pressing Continue will change the specification "
            "status to Superseded."))

    # lifecycle
    starter = exported(PublicPersonChoice(
        title=_('Starter'),
        required=False,
        readonly=True,
        description=_(
            'The person who first set the state of the '
            'spec to the values that we consider mark it as started.'),
        vocabulary='ValidPersonOrTeam'),
                       as_of="devel")
    date_started = exported(Datetime(
        title=_('Date Started'),
        required=False,
        readonly=True,
        description=_('The date when this spec was marked started.')),
                            as_of="devel")

    completer = exported(PublicPersonChoice(
        title=_('Starter'),
        required=False,
        readonly=True,
        description=_(
            'The person who finally set the state of the '
            'spec to the values that we consider mark it as complete.'),
        vocabulary='ValidPersonOrTeam'),
                         as_of="devel")

    date_completed = exported(Datetime(
        title=_('Date Completed'),
        required=False,
        readonly=True,
        description=_(
            'The date when this spec was marked '
            'complete. Note that complete also includes "obsolete" and '
            'superseded. Essentially, it is the state where no more work '
            'will be done on the feature.')),
                              as_of="devel")

    # joins
    subscriptions = Attribute('The set of subscriptions to this spec.')
    subscribers = Attribute('The set of subscribers to this spec.')
    sprints = Attribute('The sprints at which this spec is discussed.')
    sprint_links = Attribute('The entries that link this spec to sprints.')
    dependencies = exported(
        CollectionField(
            title=_('Specs on which this one depends.'),
            value_type=Reference(schema=Interface),  # ISpecification, really.
            readonly=True),
        as_of="devel")
    linked_branches = exported(
        CollectionField(
            title=_("Branches associated with this spec, usually "
                    "branches on which this spec is being implemented."),
            value_type=Reference(schema=Interface),  # ISpecificationBranch
            readonly=True),
        as_of="devel")

    def getDependencies():
        """Specs on which this one depends."""

    def getBlockedSpecs():
        """Specs for which this spec is a dependency."""

    # emergent properties
    informational = Attribute('Is True if this spec is purely informational '
                              'and requires no implementation.')
    is_complete = exported(Bool(
        title=_('Is started'),
        readonly=True,
        required=True,
        description=_(
            'Is True if this spec is already completely implemented. '
            'Note that it is True for informational specs, since '
            'they describe general functionality rather than specific '
            'code to be written. It is also true of obsolete and '
            'superseded specs, since there is no longer any need '
            'to schedule work for them.')),
                           as_of="devel")

    is_incomplete = Attribute(
        'Is True if this work still needs to '
        'be done. Is in fact always the opposite of is_complete.')
    is_blocked = Attribute('Is True if this spec depends on another spec '
                           'which is still incomplete.')
    is_started = exported(Bool(
        title=_('Is started'),
        readonly=True,
        required=True,
        description=_(
            'Is True if the spec is in a state which '
            'we consider to be "started". This looks at the delivery '
            'attribute, and also considers informational specs to be '
            'started when they are approved.')),
                          as_of="devel")

    lifecycle_status = exported(Choice(
        title=_('Lifecycle Status'),
        vocabulary=SpecificationLifecycleStatus,
        default=SpecificationLifecycleStatus.NOTSTARTED,
        readonly=True),
                                as_of="devel")

    def all_deps():
        """All the dependencies, including dependencies of dependencies.

        If a user is provided, filters to only dependencies the user can see.
        """

    def all_blocked():
        """All specs blocked on this, and those blocked on the blocked ones.

        If a user is provided, filters to only blocked dependencies the user
        can see.
        """

    def validateMove(target):
        """Check that the specification can be moved to the target."""

    def getSprintSpecification(sprintname):
        """Get the record that links this spec to the named sprint."""

    def notificationRecipientAddresses():
        """Return the list of email addresses that receive notifications."""

    has_accepted_goal = exported(Bool(
        title=_('Series goal is accepted'),
        readonly=True,
        required=True,
        description=_(
            'Is true if this specification has been '
            'proposed as a goal for a specific series, '
            'and the drivers of that series have accepted the goal.')),
                                 as_of="devel")

    # lifecycle management
    def updateLifecycleStatus(user):
        """Mark the specification as started, and/or complete, if appropriate.

        This will verify that the state of the specification is in fact
        "complete" (there is a completeness test in
        Specification.is_complete) and then record the completer and the
        date_completed. If the spec is not completed, then it ensures that
        nothing is recorded about its completion.

        It returns a SpecificationLifecycleStatus dbschema showing the
        overall state of the specification IF the state has changed.
        """

    # event-related methods
    def getDelta(old_spec, user):
        """Return a dictionary of things that changed between this spec and
        the old_spec.

        This method is primarily used by event subscription code, to
        determine what has changed during an ObjectModifiedEvent.
        """

    # subscription-related methods
    def subscription(person):
        """Return the subscription for this person to this spec, or None."""

    @operation_parameters(person=Reference(IPerson,
                                           title=_('Person'),
                                           required=True),
                          essential=copy_field(
                              ISpecificationSubscription['essential'],
                              required=False))
    @call_with(subscribed_by=REQUEST_USER)
    @export_write_operation()
    @operation_for_version('devel')
    def subscribe(person, subscribed_by=None, essential=False):
        """Subscribe this person to the feature specification."""

    @operation_parameters(person=Reference(IPerson,
                                           title=_('Person'),
                                           required=False))
    @call_with(unsubscribed_by=REQUEST_USER)
    @export_write_operation()
    @operation_for_version('devel')
    def unsubscribe(person, unsubscribed_by):
        """Remove the person's subscription to this spec."""

    def getSubscriptionByName(name):
        """Return a subscription based on the person's name, or None."""

    def isSubscribed(person):
        """Is person subscribed to this spec?

        Returns True if the user is explicitly subscribed to this spec
        (no matter what the type of subscription), otherwise False.

        If person is None, the return value is always False.
        """

    # sprints
    def linkSprint(sprint, user):
        """Put this spec on the agenda of the sprint."""

    def unlinkSprint(sprint):
        """Remove this spec from the agenda of the sprint."""

    # dependencies
    def createDependency(specification):
        """Create a dependency for this spec on the spec provided."""

    def removeDependency(specification):
        """Remove any dependency of this spec on the spec provided."""

    # branches
    def getBranchLink(branch):
        """Return the SpecificationBranch link for the branch, or None."""

    def getLinkedBugTasks(user):
        """Return the bug tasks that are relevant to this blueprint.

        When multiple tasks are on a bug, if one of the tasks is for the
        target, then only that task is returned. Otherwise the default
        bug task is returned.

        :param user: The user doing the search.
        """

    def getAllowedInformationTypes(who):
        """Get a list of acceptable `InformationType`s for this spec."""
Ejemplo n.º 12
0
class IProductLimitedView(IHasIcon, IHasLogo, IHasOwner, ILaunchpadUsage):
    """Attributes that must be visible for person with artifact grants
    on bugs, branches or specifications for the product.
    """

    display_name = exported(
        TextLine(
            title=_('Display Name'),
            description=_("""The name of the project as it would appear in a
                paragraph.""")),
        exported_as='display_name')

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

    icon = exported(
        IconImageUpload(
            title=_("Icon"), required=False,
            default_image_resource='/@@/product',
            description=_(
                "A small image of exactly 14x14 pixels and at most 5kb in "
                "size, that can be used to identify this project. The icon "
                "will be displayed next to the project name everywhere in "
                "Launchpad that we refer to the project and link to it.")))

    logo = exported(
        LogoImageUpload(
            title=_("Logo"), required=False,
            default_image_resource='/@@/product-logo',
            description=_(
                "An image of exactly 64x64 pixels that will be displayed in "
                "the heading of all pages related to this project. It should "
                "be no bigger than 50kb in size.")))

    name = exported(
        ProductNameField(
            title=_('Name'),
            constraint=name_validator,
            description=_(
                "At least one lowercase letter or number, followed by "
                "letters, numbers, dots, hyphens or pluses. "
                "Keep this name short; it is used in URLs as shown above.")))

    owner = exported(
        PersonChoice(
            title=_('Maintainer'),
            required=True,
            vocabulary='ValidPillarOwner',
            description=_("The restricted team, moderated team, or person "
                          "who maintains the project information in "
                          "Launchpad.")))
    projectgroup = exported(
        ReferenceChoice(
            title=_('Part of'),
            required=False,
            vocabulary='ProjectGroup',
            schema=IProjectGroup,
            description=_(
                'Project group. This is an overarching initiative that '
                'includes several related projects. For example, the Mozilla '
                'Project produces Firefox, Thunderbird and Gecko. This '
                'information is used to group those projects in a coherent '
                'way. If you make this project part of a group, the group '
                'preferences and decisions around bug tracking, translation '
                'and security policy will apply to this project.')),
        exported_as='project_group')

    title = exported(
        Title(
            title=_('Title'),
            description=_("The project title. Should be just a few words."),
            readonly=True))
Ejemplo n.º 13
0
class IBugAttachment(IHasBug):
    """A file attachment to an IBug.

    Launchpadlib example of accessing content of an attachment::

        for attachment in bug.attachments:
            buffer = attachment.data.open()
            for line in buffer:
                print line
            buffer.close()

    Launchpadlib example of accessing metadata about an attachment::

        attachment = bug.attachments[0]
        print "title:", attachment.title
        print "ispatch:", attachment.type

    For information about the file-like object returned by
    attachment.data.open() see lazr.restfulclient's documentation of the
    HostedFile object.

    Details about the message associated with an attachment can be found on
    the "message" attribute::

        message = attachment.message
        print "subject:", message.subject.encode('utf-8')
        print "owner:", message.owner.display_name.encode('utf-8')
        print "created:", message.date_created
    """
    export_as_webservice_entry()

    id = Int(title=_('ID'), required=True, readonly=True)
    bug = exported(
        Reference(Interface, title=_('The bug the attachment belongs to.')))
    type = exported(
        Choice(title=_('Attachment Type'),
               description=_(
                   'The type of the attachment, for example Patch or '
                   'Unspecified.'),
               vocabulary=BugAttachmentType,
               default=BugAttachmentType.UNSPECIFIED,
               required=True))
    title = exported(
        Title(title=_('Title'),
              description=_(
                  'A short and descriptive description of the attachment'),
              required=True))
    libraryfile = Bytes(title=_("The attachment content."), required=True)
    data = exported(
        Bytes(title=_("The attachment content."), required=True,
              readonly=True))
    message = exported(
        Reference(IMessage,
                  title=_("The message that was created when we "
                          "added this attachment.")))
    is_patch = Bool(title=_('Patch?'),
                    description=_('Is this attachment a patch?'),
                    readonly=True)

    @call_with(user=REQUEST_USER)
    @export_write_operation()
    def removeFromBug(user):
        """Remove the attachment from the bug."""

    def destroySelf():
        """Delete this record.

        The library file content for this attachment is set to None.
        """

    def getFileByName(filename):
        """Return the `ILibraryFileAlias for the given file name.
Ejemplo n.º 14
0
class IProductSeriesView(ISeriesMixin, IHasAppointedDriver, IHasOwner,
                         ISpecificationGoal, IHasMilestones,
                         IHasOfficialBugTags, IHasExpirableBugs,
                         IHasTranslationImports, IHasTranslationTemplates,
                         IServiceUsage):
    status = exported(
        Choice(title=_('Status'),
               required=True,
               vocabulary=SeriesStatus,
               default=SeriesStatus.DEVELOPMENT))

    parent = Attribute('The structural parent of this series - the product')

    datecreated = exported(Datetime(title=_('Date Registered'),
                                    required=True,
                                    readonly=True),
                           exported_as='date_created')

    owner = exported(
        PersonChoice(
            title=_('Owner'),
            required=True,
            vocabulary='ValidOwner',
            description=_('Project owner, either a valid Person or Team')))

    driver = exported(
        PersonChoice(
            title=_("Release manager"),
            description=_(
                "The person or team responsible for decisions about features "
                "and bugs that will be targeted to this series. If you don't "
                "nominate someone here, then the owner of this series will "
                "automatically have those permissions, as will the project "
                "and project group drivers."),
            required=False,
            vocabulary='ValidPersonOrTeam'))

    title = exported(
        Title(title=_('Title'),
              description=_("The product series title.  "
                            "Should be just a few words.")))

    displayname = exported(TextLine(
        title=_('Display Name'),
        description=_(
            "Display name.  In this case we have removed the underlying "
            "database field, and this attribute just returns the name.")),
                           exported_as='display_name')

    releases = exported(
        CollectionField(title=_("An iterator over the releases in this "
                                "Series, sorted with latest release first."),
                        readonly=True,
                        value_type=Reference(schema=IProductRelease)))

    release_files = Attribute("An iterator over the release files in this "
                              "Series, sorted with latest release first.")

    packagings = Attribute("An iterator over the Packaging entries "
                           "for this product series.")

    specifications = Attribute("The specifications targeted to this "
                               "product series.")

    sourcepackages = Attribute(
        _("List of distribution packages for this "
          "product series"))

    milestones = exported(doNotSnapshot(
        CollectionField(title=_("The visible milestones associated with this "
                                "project series, ordered by date expected."),
                        readonly=True,
                        value_type=Reference(schema=IMilestone))),
                          exported_as='active_milestones')

    all_milestones = exported(
        doNotSnapshot(
            CollectionField(title=_(
                "All milestones associated with this project series, "
                "ordered by date expected."),
                            readonly=True,
                            value_type=Reference(schema=IMilestone))))

    branch = exported(
        ReferenceChoice(title=_('Branch'),
                        vocabulary='BranchRestrictedOnProduct',
                        schema=IBranch,
                        required=False,
                        description=_(
                            "The Bazaar branch for this series.  Leave blank "
                            "if this series is not maintained in Bazaar.")))

    translations_autoimport_mode = exported(Choice(
        title=_('Import settings'),
        vocabulary=TranslationsBranchImportMode,
        required=True,
        description=_("Specify which files will be imported from the "
                      "source code branch.")),
                                            as_of="devel")

    potemplate_count = Int(
        title=_("The total number of POTemplates in this series."),
        readonly=True,
        required=True)

    productserieslanguages = Attribute(
        "The set of ProductSeriesLanguages for this series.")

    translations_branch = ReferenceChoice(
        title=_("Translations export branch"),
        vocabulary='HostedBranchRestrictedOnOwner',
        schema=IBranch,
        required=False,
        description=_("A Bazaar branch to commit translation snapshots to.  "
                      "Leave blank to disable."))

    all_specifications = doNotSnapshot(
        Attribute('All specifications linked to this series.'))

    def getCachedReleases():
        """Gets a cached copy of this series' releases.

        Returns None if there is no release."""

    def getLatestRelease():
        """Gets the most recent release in the series.

        Returns None if there is no release."""

    def getRelease(version):
        """Get the release in this series that has the specified version.
        Return None is there is no such release.
        """

    def getPackage(distroseries):
        """Return the SourcePackage for this project series in the supplied
        distroseries. This will use a Packaging record if one exists, but
        it will also work through the ancestry of the distroseries to try
        to find a Packaging entry that may be relevant."""

    def getUbuntuTranslationFocusPackage():
        """Return the SourcePackage that packages this project in Ubuntu's
        translation focus or current series or any series, in that order."""

    def setPackaging(distroseries, sourcepackagename, owner):
        """Create or update a Packaging record for this product series,
        connecting it to the given distroseries and source package name.
        """

    def getPackagingInDistribution(distribution):
        """Return all the Packaging entries for this product series for the
        given distribution. Note that this only returns EXPLICT packaging
        entries, it does not look at distro series ancestry in the same way
        that IProductSeries.getPackage() does.
        """

    def getPOTemplate(name):
        """Return the POTemplate with this name for the series."""

    # where are the tarballs released from this branch placed?
    releasefileglob = exported(TextLine(
        title=_("Release URL pattern"),
        required=False,
        constraint=validate_release_glob,
        description=_('A URL pattern that matches releases that are part '
                      'of this series.  Launchpad automatically scans this '
                      'site to import new releases.  Example: '
                      'http://ftp.gnu.org/gnu/emacs/emacs-21.*.tar.gz')),
                               exported_as='release_finder_url_pattern')

    releaseverstyle = Attribute("The version numbering style for this "
                                "series of releases.")

    is_development_focus = Attribute(
        _("Is this series the development focus for the product?"))

    @operation_parameters(include_inactive=Bool(title=_("Include inactive"),
                                                required=False,
                                                default=False))
    @export_read_operation()
    @export_operation_as('get_timeline')
    def getTimeline(include_inactive):
        """Return basic timeline data useful for creating a diagram.
Ejemplo n.º 15
0
class IBuilderView(IHasBuildRecords, IHasOwner):

    id = Attribute("Builder identifier")

    processor = exported(ReferenceChoice(
        title=_('Processor'),
        required=True,
        vocabulary='Processor',
        schema=IProcessor,
        description=_(
            'DEPRECATED: Processor identifying jobs which can be built by '
            'this device. Use `processors` instead to handle multiple '
            'supported architectures.')),
                         as_of='devel')

    processors = exported(List(
        title=_("Processors"),
        description=_("Processors identifying jobs which can be built by this "
                      "device."),
        value_type=ReferenceChoice(vocabulary='Processor', schema=IProcessor)),
                          as_of='devel')

    owner = exported(
        PersonChoice(title=_('Owner'),
                     required=True,
                     vocabulary='ValidOwner',
                     description=_('Builder owner, a Launchpad member which '
                                   'will be responsible for this device.')))

    url = exported(
        TextLine(title=_('URL'),
                 required=True,
                 constraint=builder_url_validator,
                 description=_(
                     'The URL to the build machine, used as a unique '
                     'identifier. Includes protocol, host and port only, '
                     'e.g.: http://farm.com:8221/')))

    name = exported(
        TextLine(
            title=_('Name'),
            required=True,
            constraint=name_validator,
            description=_('Builder Slave Name used for reference purposes')))

    title = exported(
        Title(title=_('Title'),
              required=True,
              description=_(
                  'The builder slave title. Should be just a few words.')))

    virtualized = exported(
        Bool(title=_('Virtualized'),
             required=True,
             default=False,
             description=_('Whether or not the builder is a virtual Xen '
                           'instance.')))

    manual = exported(
        Bool(title=_('Manual Mode'),
             required=False,
             default=False,
             description=_('The auto-build system does not dispatch '
                           'jobs automatically for slaves in manual mode.')))

    builderok = exported(
        Bool(title=_('Builder State OK'),
             required=True,
             default=True,
             description=_('Whether or not the builder is ok')))

    failnotes = exported(
        Text(title=_('Failure Notes'),
             required=False,
             description=_('The reason for a builder not being ok')))

    vm_host = exported(
        TextLine(title=_('VM host'),
                 required=False,
                 description=_('The machine hostname hosting the virtual '
                               'buildd-slave, e.g.: foobar-host.ppa')))

    vm_reset_protocol = exported(
        Choice(title=_("VM reset protocol"),
               vocabulary=BuilderResetProtocol,
               readonly=False,
               required=False,
               description=_("The protocol version for resetting the VM.")))

    active = exported(
        Bool(title=_('Publicly Visible'),
             required=False,
             default=True,
             description=_('Whether or not to present the builder publicly.')))

    currentjob = Attribute("BuildQueue instance for job being processed.")

    current_build = exported(
        Reference(
            title=_("Current build"),
            required=False,
            readonly=True,
            schema=Interface,  # Really IBuildFarmJob.
            description=_("The job currently running on this builder.")),
        as_of="devel")

    failure_count = exported(
        Int(title=_('Failure Count'),
            required=False,
            default=0,
            description=_("Number of consecutive failures for this builder.")))

    version = exported(
        Text(title=_('Version'),
             required=False,
             description=_('The version of launchpad-buildd on the slave.')))

    clean_status = exported(
        Choice(
            title=_("Clean status"),
            vocabulary=BuilderCleanStatus,
            readonly=True,
            description=_(
                "The readiness of the slave to take a job. Only internal build "
                "infrastructure bots need to or should write to this.")))

    date_clean_status_changed = exported(
        Datetime(title=_("Date clean status changed"),
                 readonly=True,
                 description=_(
                     "The date the builder's clean status last changed.")))

    def gotFailure():
        """Increment failure_count on the builder."""

    def resetFailureCount():
        """Set the failure_count back to zero."""

    def failBuilder(reason):
        """Mark builder as failed for a given reason."""

    def acquireBuildCandidate():
        """Acquire a build candidate in an atomic fashion.
Ejemplo n.º 16
0
class IBuilder(IHasOwner):
    """Build-slave information and state.

    Builder instance represents a single builder slave machine within the
    Launchpad Auto Build System. It should specify a 'processor' on which the
    machine is based and is able to build packages for; a URL, by which the
    machine is accessed through an XML-RPC interface; name, title for entity
    identification and browsing purposes; an LP-like owner which has
    unrestricted access to the instance; the build slave machine status
    representation, including the field/properties: virtualized, builderok,
    status, failnotes and currentjob.
    """
    export_as_webservice_entry()

    id = Attribute("Builder identifier")

    processor = exported(ReferenceChoice(
        title=_('Processor'), required=True, vocabulary='Processor',
        schema=IProcessor,
        description=_('Build Slave Processor, used to identify '
                      'which jobs can be built by this device.')),
        as_of='devel')

    owner = exported(PersonChoice(
        title=_('Owner'), required=True, vocabulary='ValidOwner',
        description=_('Builder owner, a Launchpad member which '
                      'will be responsible for this device.')))

    url = exported(TextLine(
        title=_('URL'), required=True, constraint=builder_url_validator,
        description=_('The URL to the build machine, used as a unique '
                      'identifier. Includes protocol, host and port only, '
                      'e.g.: http://farm.com:8221/')))

    name = exported(TextLine(
        title=_('Name'), required=True, constraint=name_validator,
        description=_('Builder Slave Name used for reference proposes')))

    title = exported(Title(
        title=_('Title'), required=True,
        description=_(
            'The builder slave title. Should be just a few words.')))

    virtualized = exported(Bool(
        title=_('Virtualized'), required=True, default=False,
        description=_('Whether or not the builder is a virtual Xen '
                      'instance.')))

    manual = exported(Bool(
        title=_('Manual Mode'), required=False, default=False,
        description=_('The auto-build system does not dispatch '
                      'jobs automatically for slaves in manual mode.')))

    builderok = exported(Bool(
        title=_('Builder State OK'), required=True, default=True,
        description=_('Whether or not the builder is ok')))

    failnotes = exported(Text(
        title=_('Failure Notes'), required=False,
        description=_('The reason for a builder not being ok')))

    vm_host = exported(TextLine(
        title=_('Virtual Machine Host'), required=False,
        description=_('The machine hostname hosting the virtual '
                      'buildd-slave, e.g.: foobar-host.ppa')))

    active = exported(Bool(
        title=_('Publicly Visible'), required=True, default=True,
        description=_('Whether or not to present the builder publicly.')))

    currentjob = Attribute("BuildQueue instance for job being processed.")

    failure_count = exported(Int(
        title=_('Failure Count'), required=False, default=0,
       description=_("Number of consecutive failures for this builder.")))

    def gotFailure():
        """Increment failure_count on the builder."""

    def resetFailureCount():
        """Set the failure_count back to zero."""

    def failBuilder(reason):
        """Mark builder as failed for a given reason."""

    def acquireBuildCandidate():
        """Acquire a build candidate in an atomic fashion.

        When retrieiving a candidate we need to mark it as building
        immediately so that it is not dispatched by another builder in the
        build manager.

        We can consider this to be atomic because although the build manager
        is a Twisted app and gives the appearance of doing lots of things at
        once, it's still single-threaded so no more than one builder scan
        can be in this code at the same time.

        If there's ever more than one build manager running at once, then
        this code will need some sort of mutex.
        """

    def handleFailure(logger):
        """Handle buildd slave failures.
Ejemplo n.º 17
0
class IProjectGroupPublic(ICanGetMilestonesDirectly, IHasAppointedDriver,
                          IHasBranches, IHasBugs, IHasDrivers, IHasIcon,
                          IHasLogo, IHasMergeProposals, IHasMilestones,
                          IHasMugshot, IHasOwner, IHasSpecifications,
                          IHasSprints, IMakesAnnouncements, IKarmaContext,
                          IHasOfficialBugTags, IServiceUsage):
    """Public IProjectGroup properties."""

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

    # The following milestone collections are copied from IHasMilestone so that
    # we can override the collection value types to be IProjectGroupMilestone.
    milestones = copy_field(
        IHasMilestones['milestones'],
        value_type=Reference(schema=IProjectGroupMilestone))

    all_milestones = copy_field(
        IHasMilestones['all_milestones'],
        value_type=Reference(schema=IProjectGroupMilestone))

    owner = exported(
        PublicPersonChoice(
            title=_('Maintainer'),
            required=True,
            vocabulary='ValidPillarOwner',
            description=_("The restricted team, moderated team, or person "
                          "who maintains the project group information in "
                          "Launchpad.")))

    registrant = exported(
        PublicPersonChoice(title=_('Registrant'),
                           required=True,
                           readonly=True,
                           vocabulary='ValidPersonOrTeam',
                           description=_(
                               "Project group registrant. Must be a valid "
                               "Launchpad Person.")))

    display_name = exported(
        TextLine(title=_('Display Name'),
                 description=_(
                     "Appropriately capitalised, "
                     'and typically ending in "Project". '
                     "Examples: the Apache Project, the Mozilla Project, "
                     "the Gimp Project.")))

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

    title = exported(
        Title(title=_('Title'),
              description=_("The full name of the project group, "
                            "which can contain spaces, special characters, "
                            "etc.")))

    summary = exported(
        Summary(
            title=_('Project Group Summary'),
            description=_(
                "A short paragraph to introduce the project group's work.")))

    description = exported(
        Text(title=_('Description'),
             description=_(
                 "Details about the project group's work, goals, and "
                 "how to contribute. Use plain text, paragraphs are preserved "
                 "and URLs are linked in pages. Don't repeat the Summary.")))

    datecreated = exported(Datetime(
        title=_('Date Created'),
        description=_("The date this project group was created in Launchpad."),
        readonly=True),
                           exported_as="date_created")

    driver = exported(
        PublicPersonChoice(
            title=_("Driver"),
            description=_(
                "This is a project group-wide appointment. Think carefully "
                "here! This person or team will be able to set feature goals "
                "and approve bug targeting and backporting for ANY series in "
                "ANY project in this group. You can also appoint drivers "
                "at the level of a specific project or series. So you may "
                "just want to leave this space blank, and instead let the "
                "individual projects and series have drivers."),
            required=False,
            vocabulary='ValidPersonOrTeam'))

    homepageurl = exported(URIField(title=_('Homepage URL'),
                                    required=False,
                                    allowed_schemes=['http', 'https', 'ftp'],
                                    allow_userinfo=False,
                                    description=_(
                                        "The project group home page. "
                                        "Please include the http://")),
                           exported_as="homepage_url")

    wikiurl = exported(URIField(
        title=_('Wiki URL'),
        required=False,
        allowed_schemes=['http', 'https', 'ftp'],
        allow_userinfo=False,
        description=_("The URL of this project group's wiki, "
                      "if it has one. Please include the http://")),
                       exported_as="wiki_url")

    lastdoap = TextLine(title=_('Last-parsed RDF fragment'),
                        description=_("The last RDF fragment for this "
                                      "entity that we received and parsed, or "
                                      "generated."),
                        required=False)

    sourceforgeproject = exported(TextLine(
        title=_("SourceForge Project Name"),
        description=_("The SourceForge project name for this "
                      "project group, if it is in SourceForge."),
        required=False),
                                  exported_as="sourceforge_project")

    freshmeatproject = exported(TextLine(
        title=_("Freshmeat Project Name"),
        description=_("The Freshmeat project name for this "
                      "project group, if it is in Freshmeat. "
                      "[DEPRECATED]"),
        required=False),
                                exported_as="freshmeat_project")

    homepage_content = exported(
        Text(title=_("Homepage Content"),
             required=False,
             description=_(
                 "The content of this project group'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='/@@/project',
            description=_(
                "A small image of exactly 14x14 pixels and at most 5kb in "
                "size, that can be used to identify this project group. The "
                "icon will be displayed in Launchpad everywhere that we link "
                "to this project group. For example in listings or tables of "
                "active project groups.")))

    logo = exported(
        LogoImageUpload(
            title=_("Logo"),
            required=False,
            default_image_resource='/@@/project-logo',
            description=_(
                "An image of exactly 64x64 pixels that will be displayed in "
                "the heading of all pages related to this project group. It "
                "should be no bigger than 50kb in size.")))

    mugshot = exported(
        MugshotImageUpload(
            title=_("Brand"),
            required=False,
            default_image_resource='/@@/project-mugshot',
            description=_(
                "A large image of exactly 192x192 pixels, that will be "
                "displayed on this project group's home page in Launchpad. "
                "It should be no bigger than 100kb in size. ")))

    bugtracker = exported(ReferenceChoice(
        title=_('Bug Tracker'),
        required=False,
        vocabulary='BugTracker',
        schema=IBugTracker,
        description=_(
            "The bug tracker the projects in this project group use.")),
                          exported_as="bug_tracker")

    # products.value_type will be set to IProduct once IProduct is defined.
    products = exported(CollectionField(
        title=_('List of active projects for this project group.'),
        value_type=Reference(Interface)),
                        exported_as="projects")

    bug_reporting_guidelines = exported(
        Text(title=(u"If I\N{right single quotation mark}m reporting a bug, "
                    u"I should include, if possible"),
             description=(u"These guidelines will be shown to "
                          "anyone reporting a bug."),
             required=False,
             max_length=50000))

    bug_reported_acknowledgement = exported(
        Text(title=(u"After reporting a bug, I can expect the following."),
             description=(u"This message of acknowledgement will be displayed "
                          "to anyone after reporting a bug."),
             required=False,
             max_length=50000))

    enable_bugfiling_duplicate_search = Bool(
        title=u"Search for possible duplicate bugs when a new bug is filed",
        required=False,
        readonly=True)

    translatables = Attribute("Products that are translatable in LP")

    def getProduct(name):
        """Get a product with name `name`."""

    def getConfigurableProducts():
        """Get all products that can be edited by user."""

    def has_translatable():
        """Return a boolean showing the existance of translatables products.
        """

    def has_branches():
        """Return a boolean showing the existance of products with branches.
        """

    def hasProducts():
        """Returns True if a project has products associated with it, False
        otherwise.
        """

    def getSeries(series_name):
        """Return a ProjectGroupSeries object with name `series_name`."""

    product_milestones = Attribute('all the milestones for all the products.')
Ejemplo n.º 18
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 ISpecificationWorkItem(Interface):
    """SpecificationWorkItem's public attributes and methods."""

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

    title = Title(title=_('Title'),
                  required=True,
                  readonly=False,
                  description=_("Work item title."))

    assignee = PublicPersonChoice(
        title=_('Assignee'),
        required=False,
        readonly=False,
        description=_(
            "The person responsible for implementing the work item."),
        vocabulary='ValidPersonOrTeam')

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

    milestone = Choice(
        title=_('Milestone'),
        required=False,
        readonly=False,
        vocabulary='Milestone',
        description=_(
            "The milestone to which this work item is targetted. If this "
            "is not set, then the target is the specification's "
            "milestone."))

    status = Choice(title=_("Work Item Status"),
                    required=True,
                    readonly=False,
                    default=SpecificationWorkItemStatus.TODO,
                    vocabulary=SpecificationWorkItemStatus,
                    description=_(
                        "The state of progress being made on the actual "
                        "implementation of this work item."))

    specification = Choice(
        title=_('The specification that the work item is linked to.'),
        required=True,
        readonly=True,
        vocabulary='Specification')

    deleted = Bool(title=_('Is this work item deleted?'),
                   required=True,
                   readonly=False,
                   default=False,
                   description=_("Marks the work item as deleted."))

    sequence = Int(
        title=_("Work Item Sequence."),
        required=True,
        description=_(
            "The sequence in which the work items are to be displayed in the "
            "UI."))

    is_complete = Bool(
        readonly=True,
        description=_(
            "True or False depending on whether or not there is more "
            "work required on this work item."))
Ejemplo n.º 20
0
class ITranslationGroup(IHasOwner):
    """A TranslationGroup."""

    export_as_webservice_entry(
        singular_name='translation_group', plural_name='translation_groups')

    id = Int(
            title=_('Translation Group ID'), required=True, readonly=True,
            )
    name = exported(
        TextLine(
            title=_('Name'), required=True,
            description=_("""Keep this name very short, unique, and
            descriptive, because it will be used in URLs. Examples:
            gnome-translation-project, ubuntu-translators."""),
            constraint=name_validator),
        as_of="devel"
        )
    title = exported(
        Title(
            title=_('Title'), required=True,
            description=_("""Title of this Translation Group.
            This title is displayed at the top of the Translation Group
            page and in lists or reports of translation groups.  Do not
            add "translation group" to this title, or it will be shown
            double.
            """),),
        as_of="devel"
        )
    summary = Summary(
            title=_('Summary'), required=True,
            description=_("""A single-paragraph description of the
            group. This will also be displayed in most
            translation group listings."""),
            )
    datecreated = Datetime(
            title=_('Date Created'), required=True, readonly=True,
            )
    owner = PublicPersonChoice(
            title=_('Owner'), required=True, vocabulary='ValidOwner',
            description=_("The owner's IPerson"))
    # joins
    translators = Attribute('The set of translators for this group.')
    projects = Attribute('The projects for which this group translates.')
    products = Attribute('The projects to which this group is directly '
        'appointed as a translator. There may be other projects that are '
        'part of project groups for which the group also translates.')
    distributions = Attribute('The distros for which this group translates.')

    translation_guide_url = URIField(
        title=_('Translation instructions'), required=False,
        allowed_schemes=['http', 'https', 'ftp'],
        allow_userinfo=False,
        description=_("The URL of the generic translation instructions "
                      "followed by this particular translation group. "
                      "This should include team policies and "
                      "recommendations, specific instructions for "
                      "any non-standard behaviour and other documentation."
                      "Can be any of http://, https://, or ftp://."))

    # accessing the translator list
    def query_translator(language):
        """Retrieve a translator, or None, based on a Language"""

    # adding and removing translators
    def remove_translator(language):
        """Remove the translator for this language from the group."""

    # used for the form machinery
    def add(content):
        """Add a new object."""

    top_projects = Attribute(
        "Most relevant projects using this translation group.")

    number_of_remaining_projects = Attribute(
        "Count of remaining projects not listed in the `top_projects`.")

    def __getitem__(language_code):
        """Retrieve the translator for the given language in this group.

        This is used for navigation through the group.
        """

    def fetchTranslatorData():
        """Fetch translators and related data.

        Prefetches display-related properties.

        :return: A result set of (`Translator`, `Language`, `Person`),
            ordered by language name in English.
        """

    def fetchProjectsForDisplay(user):
        """Fetch `Product`s using this group, for display purposes.

        Prefetches display-related properties.

        :return: A result set of `Product`, ordered by display name.
        """

    def fetchProjectGroupsForDisplay():
        """Fetch `Project`s using this group, for display purposes.

        Prefetches display-related properties.

        :return: A result set of `Project`, ordered by display name.
        """

    def fetchDistrosForDisplay():
        """Fetch `Distribution`s using this group, for display purposes.