コード例 #1
0
class ILiveFSEditableAttributes(IHasOwner):
    """`ILiveFS` attributes that can be edited.

    These attributes need launchpad.View to see, and launchpad.Edit to change.
    """
    date_last_modified = exported(Datetime(
        title=_("Date last modified"), required=True, readonly=True))

    owner = exported(PersonChoice(
        title=_("Owner"), required=True, readonly=False,
        vocabulary="AllUserTeamsParticipationPlusSelf",
        description=_("The owner of this live filesystem image.")))

    distro_series = exported(Reference(
        IDistroSeries, title=_("Distro Series"), required=True, readonly=False,
        description=_("The series for which the image should be built.")))

    name = exported(TextLine(
        title=_("Name"), required=True, readonly=False,
        constraint=name_validator,
        description=_("The name of the live filesystem image.")))

    metadata = exported(Dict(
        title=_(
            "A dict of data about the image.  Entries here will be passed to "
            "the builder slave."),
        key_type=TextLine(), required=True, readonly=False))
コード例 #2
0
class ISnapBaseEditableAttributes(Interface):
    """`ISnapBase` attributes that can be edited.

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

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

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

    distro_series = exported(
        Reference(IDistroSeries,
                  title=_("Distro series"),
                  required=True,
                  readonly=False))

    build_channels = exported(
        Dict(
            title=_("Source snap channels for builds"),
            key_type=TextLine(),
            required=True,
            readonly=False,
            description=_(
                "A dictionary mapping snap names to channels to use when building "
                "snaps that specify this base.")))
コード例 #3
0
class IEmailAddress(IHasOwner):
    """The object that stores the `IPerson`'s emails."""
    export_as_webservice_entry(plural_name='email_addresses')

    id = Int(title=_('ID'), required=True, readonly=True)
    email = exported(
        TextLine(title=_('Email Address'), required=True, readonly=True))
    status = Choice(title=_('Email Address Status'),
                    required=True,
                    readonly=False,
                    vocabulary=EmailAddressStatus)
    person = exported(
        Reference(title=_('Person'),
                  required=True,
                  readonly=False,
                  schema=Interface))
    personID = Int(title=_('PersonID'), required=True, readonly=True)

    rdf_sha1 = TextLine(
        title=_("RDF-ready SHA-1 Hash"),
        description=_("The SHA-1 hash of the preferred email address and "
                      "a mailto: prefix as a hexadecimal string. This is "
                      "used as a key by FOAF RDF spec"),
        readonly=True)

    def destroySelf():
        """Destroy this email address and any associated subscriptions.

        :raises UndeletableEmailAddress: When the email address is a person's
            preferred one or a hosted mailing list's address.
        """

    def syncUpdate():
        """Write updates made on this object to the database.
コード例 #4
0
class IDistroSeriesDifferenceComment(Interface):
    """A comment for a distroseries difference record."""
    export_as_webservice_entry()

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

    distro_series_difference = Reference(
        IDistroSeriesDifference, title=_("Distro series difference"),
        required=True, readonly=True, description=_(
            "The distro series difference to which this message "
            "belongs."))
    message = Reference(
        IMessage, title=_("Message"), required=True, readonly=True,
        description=_("A comment about this difference."))

    body_text = exported(Text(
        title=_("Comment text"), readonly=True, description=_(
            "The comment text for the related distro series difference.")))

    comment_author = exported(Reference(
        # Really IPerson.
        Interface, title=_("The author of the comment."),
        readonly=True))

    comment_date = exported(Datetime(
        title=_('Comment date.'), readonly=True))

    source_package_name = exported(TextLine(
        title=_("Source package name"), required=True, readonly=True,
        description=_(
            "Name of the source package that this comment is for.")))
コード例 #5
0
ファイル: ssh.py プロジェクト: pombredanne/launchpad-3
class ISSHKey(Interface):
    """SSH public key"""

    export_as_webservice_entry('ssh_key')

    id = Int(title=_("Database ID"), required=True, readonly=True)
    person = Int(title=_("Owner"), required=True, readonly=True)
    personID = Int(title=_('Owner ID'), required=True, readonly=True)
    keytype = exported(
        Choice(title=_("Key type"),
               required=True,
               vocabulary=SSHKeyType,
               readonly=True))
    keytext = exported(
        TextLine(title=_("Key text"), required=True, readonly=True))
    comment = exported(
        TextLine(title=_("Comment describing this key"),
                 required=True,
                 readonly=True))

    def destroySelf():
        """Remove this SSHKey from the database."""

    def getFullKeyText():
        """Get the full text of the SSH key."""
コード例 #6
0
class IBugTrackerComponentGroup(Interface):
    """A collection of components in a remote bug tracker.

    Some bug trackers organize sets of components into higher level groups,
    such as Bugzilla's 'product'.
    """
    export_as_webservice_entry()

    id = Int(title=_('ID'))
    name = exported(
        Text(
            title=_('Name'),
            description=_('The name of the bug tracker product.')))
    components = exported(
        CollectionField(
            title=_('Components.'),
            value_type=Reference(schema=IBugTrackerComponent)))
    bug_tracker = exported(
        Reference(title=_('BugTracker'), schema=IBugTracker))

    @operation_parameters(
        component_name=TextLine(
            title=u"The name of the remote software component to be added",
            required=True))
    @export_write_operation()
    def addComponent(component_name):
        """Adds a component to be tracked as part of this component group"""
コード例 #7
0
class IBug(IBugPublic, IBugView, IBugAppend, IHasLinkedBranches):
    """The core bug entry."""
    export_as_webservice_entry()

    linked_bugbranches = exported(CollectionField(
        title=_("Bazaar branches associated with this bug, usually "
                "branches on which this bug is being fixed."),
        value_type=Reference(schema=IBugBranch),
        readonly=True),
                                  exported_as='linked_branches')

    @accessor_for(linked_bugbranches)
    @call_with(user=REQUEST_USER)
    @export_read_operation()
    @operation_for_version('beta')
    def getVisibleLinkedBranches(user):
        """Return all the branches linked to the bug that `user` can see."""

    linked_merge_proposals = exported(
        CollectionField(
            title=_("Merge proposals associated with this bug (currently only "
                    "Git-based merge proposals)."),
            # Really IBranchMergeProposal, patched in
            # _schema_circular_imports.py.
            value_type=Reference(schema=Interface),
            readonly=True),
        as_of='devel')

    @accessor_for(linked_merge_proposals)
    @call_with(user=REQUEST_USER)
    @export_read_operation()
    @operation_for_version('devel')
    def getVisibleLinkedMergeProposals(user):
        """Return all the MPs linked to the bug that `user` can see."""
コード例 #8
0
class ISeriesMixin(IHasDrivers):
    """Methods & properties shared between distro & product series."""

    active = exported(Bool(
        title=_("Active"),
        description=_(
            "Whether or not this series is stable and supported, or "
            "under current development. This excludes series which "
            "are experimental or obsolete.")))

    summary = exported(
        Summary(title=_("Summary"),
             description=_('A single paragraph that explains the goals of '
                           'of this series and the intended users. '
                           'For example: "The 2.0 series of Apache '
                           'represents the current stable series, '
                           'and is recommended for all new deployments".'),
             required=True))

    drivers = exported(
        CollectionField(
            title=_(
                'A list of the people or teams who are drivers for this '
                'series. This list is made up of any drivers or owners '
                'from this series and the parent drivers.'),
            readonly=True,
            value_type=Reference(schema=IPerson)))

    bug_supervisor = CollectionField(
        title=_('Currently just a reference to the parent bug '
                'supervisor.'),
        readonly=True,
        value_type=Reference(schema=IPerson))
コード例 #9
0
class ISpecificationBranch(Interface):
    """A branch linked to a specification."""

    export_as_webservice_entry(as_of="beta")

    id = Int(title=_("Specification Branch #"))
    specification = exported(ReferenceChoice(title=_("Blueprint"),
                                             vocabulary="Specification",
                                             required=True,
                                             readonly=True,
                                             schema=ISpecification),
                             as_of="beta")
    branch = exported(ReferenceChoice(title=_("Branch"),
                                      vocabulary="Branch",
                                      required=True,
                                      schema=IBranch),
                      as_of="beta")

    datecreated = Attribute("The date on which I was created.")
    registrant = exported(Reference(
        schema=IPerson,
        readonly=True,
        required=True,
        title=_("The person who linked the bug to the branch")),
                          as_of="beta")

    @export_operation_as('delete')
    @export_write_operation()
    @operation_for_version('beta')
    def destroySelf():
        """Destroy this specification branch link"""
コード例 #10
0
class IBugBranch(IHasDateCreated, IHasBug, IHasBranchTarget):
    """A branch linked to a bug."""

    export_as_webservice_entry()

    id = Int(title=_("Bug Branch #"))
    bug = exported(
        BugField(
            title=_("Bug #"),
            required=True, readonly=True))
    branch_id = Int(title=_("Branch ID"), required=True, readonly=True)
    branch = exported(
        ReferenceChoice(
            title=_("Branch"), schema=IBranch,
            vocabulary="Branch", required=True))
    revision_hint = TextLine(title=_("Revision Hint"))

    bug_task = Object(
        schema=IBugTask, title=_("The bug task that the branch fixes"),
        description=_(
            "the bug task reported against this branch's product or the "
            "first bug task (in case where there is no task reported "
            "against the branch's product)."),
        readonly=True)

    registrant = Object(
        schema=IPerson, readonly=True, required=True,
        title=_("The person who linked the bug to the branch"))
コード例 #11
0
class ISourcePackageRecipeData(Interface):
    """A recipe as database data, not text."""

    base_branch = exported(
        Reference(IBranch,
                  title=_("The base branch used by this recipe."),
                  required=False,
                  readonly=True))
    base_git_repository = exported(
        Reference(IGitRepository,
                  title=_("The base Git repository used by this recipe."),
                  required=False,
                  readonly=True))
    base = Attribute(
        "The base branch/repository used by this recipe (VCS-agnostic).")

    deb_version_template = exported(
        TextLine(
            title=_('deb-version template'),
            readonly=True,
            description=_(
                'The template that will be used to generate a deb version.')))

    def getReferencedBranches():
        """An iterator of the branches referenced by this recipe."""
コード例 #12
0
class IPublishingView(Interface):
    """Base interface for all Publishing classes"""

    files = Attribute("Files included in this publication.")
    displayname = exported(
        TextLine(
            title=_("Display Name"),
            description=_("Text representation of the current record.")),
        exported_as="display_name")
    age = Attribute("Age of the publishing record.")

    component_name = exported(
        TextLine(
            title=_("Component Name"),
            required=False, readonly=True))
    section_name = exported(
        TextLine(
            title=_("Section Name"),
            required=False, readonly=True))

    def publish(diskpool, log):
        """Publish or ensure contents of this publish record

        Skip records which attempt to overwrite the archive (same file paths
        with different content) and do not update the database.

        If all the files get published correctly update its status properly.
        """

    def requestObsolescence():
        """Make this publication obsolete.
コード例 #13
0
ファイル: diff.py プロジェクト: pombreda/UnnaturalCodeFork
class IDiff(Interface):
    """A diff that is stored in the Library."""

    text = Text(
        title=_('Textual contents of a diff.'),
        readonly=True,
        description=_("The text may be cut off at a defined maximum size."))

    oversized = Bool(
        readonly=True,
        description=_(
            "True if the size of the content is over the defined maximum "
            "size."))

    diff_text = exported(
        Bytes(title=_('Content of this diff'), required=True, readonly=True))

    diff_lines_count = exported(
        Int(title=_('The number of lines in this diff.'), readonly=True))

    diffstat = exported(
        Dict(title=_('Statistics about this diff'), readonly=True))

    added_lines_count = exported(
        Int(title=_('The number of lines added in this diff.'), readonly=True))

    removed_lines_count = exported(
        Int(title=_('The number of lines removed in this diff.'),
            readonly=True))
コード例 #14
0
class IGPGKey(IHasOwner):
    """OpenPGP support"""

    export_as_webservice_entry('gpg_key')

    id = Int(title=_("Database id"), required=True, readonly=True)
    keysize = Int(title=_("Keysize"), required=True)
    algorithm = Choice(title=_("Algorithm"),
                       required=True,
                       vocabulary='GpgAlgorithm')
    keyid = exported(
        TextLine(title=_("OpenPGP key ID"),
                 required=True,
                 constraint=valid_keyid,
                 readonly=True))
    fingerprint = exported(
        TextLine(title=_("User Fingerprint"),
                 required=True,
                 constraint=valid_fingerprint,
                 readonly=True))
    active = Bool(title=_("Active"), required=True)
    displayname = Attribute("Key Display Name")
    keyserverURL = Attribute(
        "The URL to retrieve this key from the keyserver.")
    can_encrypt = Bool(title=_("Key can be used for encryption"),
                       required=True)
    owner = Int(title=_('Person'), required=True, readonly=True)
    ownerID = Int(title=_('Owner ID'), required=True, readonly=True)
コード例 #15
0
ファイル: snap.py プロジェクト: pombredanne/launchpad-3
class ISnapAdminAttributes(Interface):
    """`ISnap` attributes that can be edited by admins.

    These attributes need launchpad.View to see, and launchpad.Admin to change.
    """

    private = exported(Bool(
        title=_("Private"), required=False, readonly=False,
        description=_("Whether or not this snap is private.")))

    require_virtualized = exported(Bool(
        title=_("Require virtualized builders"), required=True, readonly=False,
        description=_("Only build this snap package on virtual builders.")))

    processors = exported(CollectionField(
        title=_("Processors"),
        description=_(
            "The architectures for which the snap package should be built."),
        value_type=Reference(schema=IProcessor),
        readonly=False))

    allow_internet = exported(Bool(
        title=_("Allow external network access"),
        required=True, readonly=False,
        description=_(
            "Allow access to external network resources via a proxy.  "
            "Resources hosted on Launchpad itself are always allowed.")))
コード例 #16
0
class IProcessor(Interface):
    """The SQLObject Processor Interface"""

    # XXX: BradCrittenden 2011-06-20 bug=760849: The following use of 'beta'
    # is a work-around to allow the WADL to be generated.  It is a bald-faced
    # lie, though.  The class is being exported in 'devel' but in order to get
    # the WADL generation work it must be back-dated to the earliest version.
    # Note that individual attributes and methods can and must truthfully set
    # 'devel' as their version.
    export_as_webservice_entry(publish_web_link=False, as_of='beta')
    id = Attribute("The Processor ID")
    name = exported(
        TextLine(title=_("Name"),
                 description=_("The Processor Name")),
        as_of='devel', readonly=True)
    title = exported(
        TextLine(title=_("Title"),
                 description=_("The Processor Title")),
        as_of='devel', readonly=True)
    description = exported(
        Text(title=_("Description"),
             description=_("The Processor Description")),
        as_of='devel', readonly=True)
    restricted = exported(
        Bool(title=_("Whether this processor is restricted.")),
        as_of='devel', readonly=True)
コード例 #17
0
class IQuestionSubscription(Interface):
    """A subscription for a person to a question."""

    export_as_webservice_entry(publish_web_link=False, as_of='devel')

    id = Int(title=_('ID'), readonly=True, required=True)
    person = exported(PersonChoice(title=_('Person'),
                                   required=True,
                                   vocabulary='ValidPersonOrTeam',
                                   readonly=True,
                                   description=_(
                                       "The person's Launchpad ID or "
                                       "e-mail address.")),
                      as_of="devel")
    question = exported(Reference(Interface,
                                  title=_("Question"),
                                  required=True,
                                  readonly=True),
                        as_of="devel")
    date_created = exported(Datetime(title=_('Date subscribed'),
                                     required=True,
                                     readonly=True),
                            as_of="devel")

    def canBeUnsubscribedByUser(user):
        """Can the user unsubscribe the subscriber from the question?"""
コード例 #18
0
ファイル: cve.py プロジェクト: pombreda/UnnaturalCodeFork
class ICve(Interface):
    """A single CVE database entry."""

    export_as_webservice_entry()

    id = Int(title=_('ID'), required=True, readonly=True)
    sequence = exported(
        TextLine(title=_('CVE Sequence Number'),
                 description=_('Should take the form XXXX-XXXX, all digits.'),
                 required=True,
                 readonly=False,
                 constraint=valid_cve_sequence))
    status = exported(
        Choice(title=_('Current CVE State'),
               default=CveStatus.CANDIDATE,
               description=_("Whether or not the "
                             "vulnerability has been reviewed and assigned a "
                             "full CVE number, or is still considered a "
                             "Candidate, or is deprecated."),
               required=True,
               vocabulary=CveStatus))
    description = exported(
        TextLine(title=_('Title'),
                 description=_('A description of the CVE issue. This will be '
                               'updated regularly from the CVE database.'),
                 required=True,
                 readonly=False))
    datecreated = exported(Datetime(title=_('Date Created'),
                                    required=True,
                                    readonly=True),
                           exported_as='date_created')
    datemodified = exported(Datetime(title=_('Date Modified'),
                                     required=True,
                                     readonly=False),
                            exported_as='date_modified')
    bugs = exported(
        CollectionField(
            title=_('Bugs related to this CVE entry.'),
            readonly=True,
            value_type=Reference(schema=Interface)))  # Redefined in bug.py.

    # Other attributes.
    url = exported(
        TextLine(title=_('URL'),
                 description=_("Return a URL to the site that has the CVE "
                               "data for this CVE reference.")))
    displayname = exported(TextLine(title=_("Display Name"),
                                    description=_(
                                        "A very brief name describing "
                                        "the ref and state.")),
                           exported_as='display_name')
    title = exported(
        TextLine(title=_("Title"), description=_("A title for the CVE")))
    references = Attribute("The set of CVE References for this CVE.")

    def createReference(source, content, url=None):
        """Create a new CveReference for this CVE."""

    def removeReference(ref):
        """Remove a CveReference."""
コード例 #19
0
class IBugSubscription(Interface):
    """The relationship between a person and a bug."""

    export_as_webservice_entry(publish_web_link=False, as_of="beta")

    id = Int(title=_('ID'), readonly=True, required=True)
    person = exported(PersonChoice(title=_('Person'),
                                   required=True,
                                   vocabulary='ValidPersonOrTeam',
                                   readonly=True,
                                   description=_(
                                       "The person's Launchpad ID or "
                                       "e-mail address.")),
                      as_of="beta")
    bug = exported(Reference(Interface,
                             title=_("Bug"),
                             required=True,
                             readonly=True),
                   as_of="beta")
    # We mark this as doNotSnapshot() because it's a magically-generated
    # Storm attribute and it causes Snapshot to break.
    bugID = doNotSnapshot(Int(title=u"The bug id.", readonly=True))
    bug_notification_level = exported(Choice(
        title=_("Bug notification level"),
        required=True,
        vocabulary=BugNotificationLevel,
        default=BugNotificationLevel.COMMENTS,
        description=_("The volume and type of bug notifications "
                      "this subscription will generate."),
    ),
                                      as_of="devel")
    date_created = exported(Datetime(title=_('Date subscribed'),
                                     required=True,
                                     readonly=True),
                            as_of="beta")
    subscribed_by = exported(PersonChoice(
        title=_('Subscribed by'),
        required=True,
        vocabulary='ValidPersonOrTeam',
        readonly=True,
        description=_("The person who created this subscription.")),
                             as_of="beta")

    display_subscribed_by = Attribute("`subscribed_by` formatted for display.")

    display_duplicate_subscribed_by = Attribute(
        "duplicate bug `subscribed_by` formatted for display.")

    @call_with(user=REQUEST_USER)
    @export_read_operation()
    @operation_for_version("beta")
    def canBeUnsubscribedByUser(user):
        """Can the user unsubscribe the subscriber from the bug?"""
コード例 #20
0
class IBranchMergeProposalPublic(IPrivacy):

    id = Int(title=_('DB ID'),
             required=True,
             readonly=True,
             description=_("The tracking number for this merge proposal."))
    source_branchID = Int(title=_('Source branch ID'),
                          required=True,
                          readonly=True)
    prerequisite_branchID = Int(title=_('Prerequisite branch ID'),
                                required=True,
                                readonly=True)

    # This is redefined from IPrivacy.private because the attribute is
    # read-only. The value is determined by the involved branches.
    private = exported(
        Bool(title=_("Proposal is confidential"),
             required=False,
             readonly=True,
             default=False,
             description=_(
                 "If True, this proposal is visible only to subscribers.")))

    source_branch = exported(
        ReferenceChoice(title=_('Source Branch'),
                        schema=IBranch,
                        vocabulary='Branch',
                        required=True,
                        readonly=True,
                        description=_("The branch that has code to land.")))

    target_branch = exported(
        ReferenceChoice(
            title=_('Target Branch'),
            schema=IBranch,
            vocabulary='Branch',
            required=True,
            readonly=True,
            description=_(
                "The branch that the source branch will be merged into.")))

    prerequisite_branch = exported(
        ReferenceChoice(
            title=_('Prerequisite Branch'),
            schema=IBranch,
            vocabulary='Branch',
            required=False,
            readonly=True,
            description=_(
                "The branch that the source branch branched from. "
                "If this branch is the same as the target branch, then "
                "leave this field blank.")))
コード例 #21
0
class IHasSpecifications(Interface):
    """An object that has specifications attached to it.

    For example, people, products and distributions have specifications
    associated with them, and you can use this interface to query those.
    """

    visible_specifications = exported(doNotSnapshot(
        CollectionField(
            title=_("All specifications"),
            value_type=Reference(schema=Interface),  # ISpecification, really.
            readonly=True,
            description=_(
                'A list of all specifications, regardless of status or '
                'approval or completion, for this object.'))),
        exported_as="all_specifications", as_of="devel")

    api_valid_specifications = exported(doNotSnapshot(
        CollectionField(
            title=_("Valid specifications"),
            value_type=Reference(schema=Interface),  # ISpecification, really.
            readonly=True,
            description=_(
                'All specifications that are not obsolete. When called from '
                'an ISpecificationGoal it will also exclude the ones that '
                'have not been accepted for that goal'))),
        exported_as="valid_specifications", as_of="devel")

    def specifications(user, quantity=None, sort=None, filter=None,
                       need_people=True, need_branches=True,
                       need_workitems=False):
        """Specifications for this target.

        The user specifies which user to use for calculation of visibility.
        The sort is a dbschema which indicates the preferred sort order. The
        filter is an indicator of the kinds of specs to be returned, and
        appropriate filters depend on the kind of object this method is on.
        If there is a quantity, then limit the result to that number.

        In the case where the filter is [] or None, the content class will
        decide what its own appropriate "default" filter is. In some cases,
        it will show all specs, in others, all approved specs, and in
        others, all incomplete specs.

        If need_people is True, then the assignee, drafter and approver will
        be preloaded, if need_branches is True, linked_branches will be
        preloaded, and if need_workitems is True, work_items will be preloaded.
        """

    def valid_specifications(**kwargs):
        """Valid specifications for this target.
コード例 #22
0
class ICodeReviewComment(Interface):
    """A link between a merge proposal and a message."""
    export_as_webservice_entry()

    id = exported(
        Int(
            title=_('DB ID'), required=True, readonly=True,
            description=_("The tracking number for this comment.")))

    branch_merge_proposal = exported(
        Reference(
            title=_('The branch merge proposal'), schema=IBranchMergeProposal,
            required=True, readonly=True))

    message = Object(schema=IMessage, title=_('The message.'))

    author = exported(
        Reference(title=_('Comment Author'), schema=IPerson,
                  required=True, readonly=True))

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

    vote = exported(
        Choice(
            title=_('Review'), required=False,
            vocabulary=CodeReviewVote))

    vote_tag = exported(
        TextLine(
            title=_('Vote tag'), required=False))

    title = exported(
        TextLine(
            title=_('The title of the comment')))

    message_body = exported(
        TextLine(
            title=_('The body of the code review message.'),
            readonly=True))

    def getAttachments():
        """Get the attachments from the original message.

        :return: two lists, the first being attachments that we would display
            (being plain text or diffs), and a second list being any other
            attachments.
        """

    def getOriginalEmail():
        """An email object of the original raw email if there was one."""

    as_quoted_email = exported(
        TextLine(
            title=_('The message as quoted in email.'),
            readonly=True))
コード例 #23
0
class ISnappySeriesView(Interface):
    """`ISnappySeries` attributes that anyone can view."""

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

    date_created = exported(
        Datetime(title=_("Date created"), required=True, readonly=True))

    registrant = exported(
        PublicPersonChoice(
            title=_("Registrant"),
            required=True,
            readonly=True,
            vocabulary="ValidPersonOrTeam",
            description=_("The person who registered this snappy series.")))
コード例 #24
0
class IJabberID(IHasOwner):
    """Jabber specific user ID """
    export_as_webservice_entry('jabber_id')
    id = Int(title=_("Database ID"), required=True, readonly=True)
    # schema=Interface will be overridden in person.py because of circular
    # dependencies.
    person = exported(
        Reference(title=_("Owner"),
                  required=True,
                  schema=Interface,
                  readonly=True))
    jabberid = exported(TextLine(title=_("New Jabber user ID"), required=True))

    def destroySelf():
        """Delete this JabberID from the database."""
コード例 #25
0
ファイル: branchlink.py プロジェクト: pombredanne/launchpad-3
class IHasLinkedBranches(Interface):
    """A interface for handling branch linkages."""

    linked_branches = exported(
        CollectionField(
            title=_('MultiJoin of the bugs which are dups of this one'),
            value_type=Reference(schema=IBranch),
            readonly=True))

    @call_with(registrant=REQUEST_USER)
    @operation_parameters(branch=Reference(schema=IBranch))
    @export_write_operation()
    @operation_for_version('beta')
    def linkBranch(branch, registrant):
        """Associate a branch with this bug.

        :param branch: The branch being linked to.
        :param registrant: The user linking the branch.
        """

    @call_with(user=REQUEST_USER)
    @operation_parameters(branch=Reference(schema=IBranch))
    @export_write_operation()
    @operation_for_version('beta')
    def unlinkBranch(branch, user):
        """Unlink a branch from this bug.
コード例 #26
0
ファイル: irc.py プロジェクト: pombreda/UnnaturalCodeFork
class IIrcID(IHasOwner):
    """A person's nickname on an IRC network."""
    export_as_webservice_entry('irc_id')
    id = Int(title=_("Database ID"), required=True, readonly=True)
    # schema=Interface will be overridden in person.py because of circular
    # dependencies.
    person = exported(
        Reference(title=_("Owner"),
                  required=True,
                  schema=Interface,
                  readonly=True))
    network = exported(TextLine(title=_("IRC network"), required=True))
    nickname = exported(TextLine(title=_("Nickname"), required=True))

    def destroySelf():
        """Delete this `IIrcID` from the database."""
コード例 #27
0
ファイル: bugtarget.py プロジェクト: pombredanne/launchpad-3
class IHasOfficialBugTags(Interface):
    """An entity that exposes a set of official bug tags."""

    official_bug_tags = exported(
        List(title=_("Official Bug Tags"),
             description=_("The list of bug tags defined as official."),
             value_type=Tag(),
             readonly=True))

    def getUsedBugTagsWithOpenCounts(user, tag_limit=0, include_tags=None):
        """Return name and bug count of tags having open bugs.

        :param user: The user who wants the report.
        :param tag_limit: The number of tags to return (excludes those found
            by matching include_tags). If 0 then all tags are returned. If
            non-zero then the most frequently used tags are returned.
        :param include_tags: A list of string tags to return irrespective of
            usage. Tags in this list that have no open bugs are returned with
            a count of 0. May be None if there are tags to require inclusion
            of.
        :return: A dict from tag -> count.
        """

    def _getOfficialTagClause():
        """Get the storm clause for finding this targets tags."""
コード例 #28
0
class IServiceUsage(Interface):
    """Pillar service usages."""

    # XXX: BradCrittenden 2010-08-06 bug=n/a:  I hate using the term 'pillar'
    # but cannot use 'project' or 'distribution'.  The phrase 'Where does'
    # implies an actual location not an answer of "Launchpad, externally, or
    # neither."
    answers_usage = Choice(
        title=_('Type of service for answers application'),
        description=_("Where does this pillar have an Answers forum?"),
        default=ServiceUsage.UNKNOWN,
        vocabulary=ServiceUsage)
    blueprints_usage = Choice(
        title=_('Type of service for blueprints application'),
        description=_("Where does this pillar host blueprints?"),
        default=ServiceUsage.UNKNOWN,
        vocabulary=ServiceUsage)
    codehosting_usage = Choice(
        title=_('Type of service for hosting code'),
        description=_("Where does this pillar host code?"),
        default=ServiceUsage.UNKNOWN,
        vocabulary=ServiceUsage)
    translations_usage = exported(Choice(
        title=_('Type of service for translations application'),
        description=_("Where does this pillar do translations?"),
        default=ServiceUsage.UNKNOWN,
        vocabulary=ServiceUsage),
                                  as_of="devel")
    bug_tracking_usage = Choice(
        title=_('Type of service for tracking bugs'),
        description=_("Where does this pillar track bugs?"),
        default=ServiceUsage.UNKNOWN,
        vocabulary=ServiceUsage)
    uses_launchpad = Bool(title=_('Uses Launchpad for something.'))
コード例 #29
0
class IProjectGroupModerate(IPillar):
    """IProjectGroup attributes used with launchpad.Moderate permission."""
    reviewed = exported(
        Bool(title=_('Reviewed'),
             required=False,
             description=_("Whether or not this project group has been "
                           "reviewed.")))
    name = exported(
        ProjectGroupNameField(
            title=_('Name'),
            required=True,
            description=_(
                "A unique name, used in URLs, identifying the project "
                "group.  All lowercase, no special characters. "
                "Examples: apache, mozilla, gimp."),
            constraint=name_validator))
コード例 #30
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.'))