Example #1
0
class ISearchableByQuestionOwner(IQuestionCollection):
    """Collection that support searching by question owner."""
    @operation_parameters(
        search_text=TextLine(title=_('Search text'), required=False),
        status=List(title=_('Status'),
                    required=False,
                    value_type=Choice(vocabulary=QuestionStatus)),
        language=List(title=_('Language'),
                      required=False,
                      value_type=ReferenceChoice(vocabulary='Language')),
        owner=PublicPersonChoice(title=_('Owner'),
                                 required=False,
                                 vocabulary='ValidPerson'),
        needs_attention_from=PublicPersonChoice(
            title=_('Needs attentions from'),
            required=False,
            vocabulary='ValidPerson'),
        sort=Choice(title=_('Sort'), required=False, vocabulary=QuestionSort))
    @operation_returns_collection_of(Interface)  # IQuestion.
    @export_read_operation()
    @operation_for_version('devel')
    def searchQuestions(
            search_text=None,
            # Lp wants a sequence, but lazr.restful only supports
            # lists; cast the tuple as a list.
            status=list(QUESTION_STATUS_DEFAULT_SEARCH),
            language=None,
            sort=None,
            owner=None,
            needs_attention_from=None):
        """Return the questions from the collection matching search criteria.
Example #2
0
class IExpiringMembershipNotificationJob(IPersonTransferJob):
    """A Job to send a warning about expiring membership."""

    member = PublicPersonChoice(title=_('Alias for minor_person attribute'),
                                vocabulary='ValidPersonOrTeam',
                                required=True)

    team = PublicPersonChoice(title=_('Alias for major_person attribute'),
                              vocabulary='ValidPersonOrTeam',
                              required=True)
Example #3
0
class ISelfRenewalNotificationJob(IPersonTransferJob):
    """A Job to notify about a self-renewal."""

    member = PublicPersonChoice(title=_('Alias for minor_person attribute'),
                                vocabulary='ValidPersonOrTeam',
                                required=True)

    team = PublicPersonChoice(title=_('Alias for major_person attribute'),
                              vocabulary='ValidPersonOrTeam',
                              required=True)
Example #4
0
class IMembershipNotificationJob(IPersonTransferJob):
    """A Job to notify new members of a team of that change."""

    member = PublicPersonChoice(title=_('Alias for minor_person attribute'),
                                vocabulary='ValidPersonOrTeam',
                                required=True)

    team = PublicPersonChoice(title=_('Alias for major_person attribute'),
                              vocabulary='ValidPersonOrTeam',
                              required=True)
Example #5
0
class ITeamJoinNotificationJob(IPersonTransferJob):
    """A Job to notify about a new member joining a team."""

    member = PublicPersonChoice(title=_('Alias for minor_person attribute'),
                                vocabulary='ValidPersonOrTeam',
                                required=True)

    team = PublicPersonChoice(title=_('Alias for major_person attribute'),
                              vocabulary='ValidPersonOrTeam',
                              required=True)
Example #6
0
class ISprintSpecification(Interface):
    """A link between a Sprint and a Specification."""

    id = Attribute(
        "The ID of this sprint/spec link. We expose this because there is "
        "no uniqueness of spec names across projects and of course "
        "distros, so there is no unique way to identify a sprintspec by spec "
        "name, because multiple specs at a sprint could have the same name.")
    sprint = Choice(
        title=_('Sprint'), required=True, readonly=True,
        description=_(
            "Select the meeting or sprint at which you would like "
            "feature to be discussed or implemented. The meeting organisers "
            "will review and approve or decline this request."),
        vocabulary='FutureSprint')
    specification = Int(
        title=_('Specification'), required=True, readonly=True)
    status = Choice(
        title=_('Agenda Status'), required=True,
        vocabulary=SprintSpecificationStatus)
    whiteboard = Text(
        title=_('Whiteboard'), required=False,
        description=_(
            "Any reasoning or rationale for your decision. "
            "Your changes will override the current text. Note that "
            "this is purely related to whether this spec is approved for "
            "the agenda of this meeting, not a commentary of "
            "the specification in general."))
    registrant = PublicPersonChoice(
        title=_('Nominated by'), required=False,
        vocabulary='ValidPersonOrTeam')
    date_created = Datetime(
        title=_('Date nominated'),
        description=_(
            "The date this topic was nominated for the sprint agenda."))
    decider = PublicPersonChoice(
        title=_('Decided by'), required=False,
        vocabulary='ValidPersonOrTeam')
    date_decided = Datetime(
        title=_('Date decided'),
        description=_(
            "The date this topic was reviewed and accepted or declined for "
            "the meeting agenda."))

    is_confirmed = Attribute(
        "True if this spec is confirmed for the agenda of this sprint.")
    is_decided = Attribute(
        'True if this spec has been accepted or declined for this sprint.')

    def acceptBy(decider):
        """Flag the sprint as being accepted by the decider."""

    def declineBy(decider):
        """Flag the sprint as being declined by the decider."""
Example #7
0
class IPersonMergeJob(IPersonTransferJob):
    """A Job that merges one person or team into another."""

    from_person = PublicPersonChoice(
        title=_('Alias for minor_person attribute'),
        vocabulary='ValidPersonOrTeam',
        required=True)

    to_person = PublicPersonChoice(title=_('Alias for major_person attribute'),
                                   vocabulary='ValidPersonOrTeam',
                                   required=True)

    def getErrorRecipients(self):
        """See `BaseRunnableJob`."""
Example #8
0
class IBranchMergeQueue(Interface):
    """An interface for managing branch merges."""

    export_as_webservice_entry()

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

    registrant = exported(
        PublicPersonChoice(
            title=_("The user that registered the branch."),
            required=True, readonly=True,
            vocabulary='ValidPersonOrTeam'))

    owner = exported(
        PersonChoice(
            title=_('Owner'),
            required=True, readonly=True,
            vocabulary='UserTeamsParticipationPlusSelf',
            description=_("The owner of the merge queue.")))

    name = exported(
        TextLine(
            title=_('Name'), required=True,
            description=_(
                "Keep very short, unique, and descriptive, because it will "
                "be used in URLs.  "
                "Examples: main, devel, release-1.0, gnome-vfs.")))

    description = exported(
        Text(
            title=_('Description'), required=False,
            description=_(
                'A short description of the purpose of this merge queue.')))

    configuration = exported(
        TextLine(
            title=_('Configuration'), required=False, readonly=True,
            description=_(
                "A JSON string of configuration values.")))

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

    branches = exported(
        CollectionField(
            title=_('Dependent Branches'),
            description=_(
                'A collection of branches that this queue manages.'),
            readonly=True,
            value_type=Reference(Interface)))

    @mutator_for(configuration)
    @operation_parameters(
        config=TextLine(title=_("A JSON string of configuration values.")))
    @export_write_operation()
    def setMergeQueueConfig(config):
        """Set the JSON string configuration of the merge queue.
Example #9
0
class IAnswerContact(Interface):
    """An answer contact.

    That's a person willing to receive notifications about all questions
    in a particular context.
    """

    person = PublicPersonChoice(
        title=_('Answer Contact'),
        required=False,
        description=_(
            "The person receiving notifications about all questions."),
        vocabulary='ValidPersonOrTeam')
    product = Choice(
        title=_('Project'),
        required=False,
        description=_(
            "The person wants to receive notifications about this project's "
            "questions."),
        vocabulary='Product')

    distribution = Choice(
        title=_('Distribution'),
        required=False,
        description=_("The person wants to receive notifications about this "
                      "distribution's questions."),
        vocabulary='Distribution')

    sourcepackagename = Choice(
        title=_('Source Package'),
        required=False,
        description=_("The person wants to receive notifications about this "
                      "sourcepackage's questions."),
        vocabulary='SourcePackageName')
Example #10
0
class IAdminTranslator(Interface):
    """Set of attributes that can only be edited by the owner of the
    translation group this translator is part of.

    These attributes let you add translators to translation groups and set
    the languages that the translators are responsible for. These are all
    administrative tasks.
    """

    id = Int(
            title=_('Translator ID'), required=True, readonly=True,
            )
    datecreated = Datetime(
            title=_('Date Appointed'), required=True, readonly=True,
            )
    translationgroup = Choice(title=_('Translation Group'), required=True,
        vocabulary='TranslationGroup', description=_("The translation group "
        "in which the translation team (individual supervisor) is being "
        "appointed."))
    language = Choice(title=_('Language'), required=True,
        vocabulary='Language', description=_("The language that this "
        "team or person will be responsible for."))
    translator = PublicPersonChoice(
        title=_('Translator'), required=True,
        vocabulary='ValidPersonOrTeam',
        description=_("The translation team (or individual supervisor) to "
            "be responsible for the language in this group."))
Example #11
0
class ISprintAttendance(Interface):
    """An attendance of a person at a sprint."""

    attendee = PublicPersonChoice(title=_('Attendee'),
                                  required=True,
                                  vocabulary='ValidPersonOrTeam')
    attendeeID = Attribute('db attendee value')
    sprint = Choice(
        title=_('The Sprint'),
        required=True,
        vocabulary='Sprint',
        description=_("Select the meeting from the list presented above."))
    time_starts = Datetime(title=_('From'),
                           required=True,
                           description=_(
                               "The date and time of arrival and "
                               "availability for sessions during the sprint."))
    time_ends = Datetime(
        title=_('To'),
        required=True,
        description=_(
            "The date and time of your departure. "
            "Please ensure the time reflects accurately "
            "when you will no longer be available for sessions at this event, to "
            "assist those planning the schedule."))
    is_physical = Bool(title=_("How will you be attending?"),
                       description=_(
                           "True, you will be physically present, "
                           "or false, you will be remotely present."),
                       required=False,
                       readonly=False,
                       default=True)
Example #12
0
class ISprintPublic(IHasOwner, IHasDrivers, IHasSpecifications,
                    IHeadingContext):
    """`ISprint` attributes that anyone can view."""

    id = Int(title=_('The Sprint ID'))

    displayname = Attribute('A pseudonym for the title.')
    owner = PublicPersonChoice(title=_('Owner'),
                               required=True,
                               readonly=True,
                               vocabulary='ValidPersonOrTeam')
    datecreated = Datetime(title=_('Date Created'),
                           required=True,
                           readonly=True)

    # joins
    attendees = Attribute('The set of attendees at this sprint.')
    attendances = Attribute('The set of SprintAttendance records.')

    def specificationLinks(status=None):
        """Return the SprintSpecification records matching the filter,
        quantity and sort given. The rules for filtering and sorting etc are
        the same as those for IHasSpecifications.specifications()
        """

    def getSpecificationLink(id):
        """Return the specification link for this sprint that has the given
        ID. We use the naked ID because there is no unique name for a spec
        outside of a single product or distro, and a sprint can cover
        multiple products and distros.
        """

    def isDriver(user):
        """Returns True if and only if the specified user
Example #13
0
class IGitRuleView(Interface):
    """`IGitRule` attributes that require launchpad.View."""

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

    repository = Reference(
        title=_("Repository"), required=True, readonly=True,
        schema=IGitRepository,
        description=_("The repository that this rule is for."))

    position = Int(
        title=_("Position"), required=True, readonly=True,
        description=_(
            "The position of this rule in its repository's rule order."))

    creator = PublicPersonChoice(
        title=_("Creator"), required=True, readonly=True,
        vocabulary="ValidPerson",
        description=_("The user who created this rule."))

    date_created = Datetime(
        title=_("Date created"), required=True, readonly=True,
        description=_("The time when this rule was created."))

    date_last_modified = Datetime(
        title=_("Date last modified"), required=True, readonly=True,
        description=_("The time when this rule was last modified."))

    grants = Attribute("The access grants for this rule.")
Example #14
0
class IMailingListSubscription(Interface):
    """A mailing list subscription."""

    person = PublicPersonChoice(
        title=_('Person'),
        description=_('The person who is subscribed to this mailing list.'),
        vocabulary='ValidTeamMember',
        required=True, readonly=True)

    mailing_list = Choice(
        title=_('Mailing list'),
        description=_('The mailing list for this subscription.'),
        vocabulary='ActiveMailingList',
        required=True, readonly=True)

    date_joined = Datetime(
        title=_('Date joined'),
        description=_("The date this person joined the team's mailing list."),
        required=True, readonly=True)

    email_address = Object(
        schema=IEmailAddress,
        title=_('Email address'),
        description=_(
            "The subscribed email address or None, meaning use the person's "
            'preferred email address, even if that changes.'),
        required=True)

    subscribed_address = Object(
        schema=IEmailAddress,
        title=_('Email Address'),
        description=_('The IEmailAddress this person is subscribed with.'),
        readonly=True)
Example #15
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)
Example #16
0
class ReassignSchema(Interface):
    """Schema to use when reassigning the reviewer for a requested review."""

    reviewer = PublicPersonChoice(
        title=_('Reviewer'),
        required=True,
        description=_('A person who you want to review this.'),
        vocabulary='ValidBranchReviewer')
Example #17
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.'))
Example #18
0
class IGitActivity(Interface):
    """An activity log entry for a Git repository."""

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

    repository = Reference(
        title=_("Repository"),
        required=True,
        readonly=True,
        schema=IGitRepository,
        description=_("The repository that this log entry is for."))

    date_changed = Datetime(
        title=_("Date changed"),
        required=True,
        readonly=True,
        description=_("The time when this change happened."))

    changer = PublicPersonChoice(
        title=_("Changer"),
        required=True,
        readonly=True,
        vocabulary="ValidPerson",
        description=_("The user who made this change."))

    changee = PersonChoice(
        title=_("Changee"),
        required=False,
        readonly=True,
        vocabulary="ValidPersonOrTeam",
        description=_("The person or team that this change was applied to."))

    changee_description = Attribute(
        "A human-readable description of the changee.")

    what_changed = Choice(
        title=_("What changed"),
        required=True,
        readonly=True,
        vocabulary=GitActivityType,
        description=_("The property of the repository that changed."))

    old_value = Dict(
        title=_("Old value"),
        required=False,
        readonly=True,
        description=_("Representation of the value before the change."),
        key_type=TextLine(),
        value_type=Text())

    new_value = Dict(
        title=_("New value"),
        required=False,
        readonly=True,
        description=_("Representation of the value after the change."),
        key_type=TextLine(),
        value_type=Text())
Example #19
0
class IPersonDeactivateJob(IPersonTransferJob):
    """A Job that deactivates a person."""

    person = PublicPersonChoice(title=_('Alias for person attribute'),
                                vocabulary='ValidPersonOrTeam',
                                required=True)

    def getErrorRecipients(self):
        """See `BaseRunnableJob`."""
Example #20
0
class IStructuralSubscriptionPublic(Interface):
    """The public parts of a subscription to a Launchpad structure."""

    id = Int(title=_('ID'), readonly=True, required=True)
    product = Int(title=_('Product'), required=False, readonly=True)
    productseries = Int(title=_('Product series'),
                        required=False,
                        readonly=True)
    projectgroup = Int(title=_('Project group'), required=False, readonly=True)
    milestone = Int(title=_('Milestone'), required=False, readonly=True)
    distribution = Int(title=_('Distribution'), required=False, readonly=True)
    distroseries = Int(title=_('Distribution series'),
                       required=False,
                       readonly=True)
    sourcepackagename = Int(title=_('Source package name'),
                            required=False,
                            readonly=True)
    subscriber = exported(
        PersonChoice(title=_('Subscriber'),
                     required=True,
                     vocabulary='ValidPersonOrTeam',
                     readonly=True,
                     description=_("The person subscribed.")))
    subscribed_by = exported(
        PublicPersonChoice(
            title=_('Subscribed by'),
            required=True,
            vocabulary='ValidPersonOrTeam',
            readonly=True,
            description=_("The person creating the subscription.")))
    date_created = exported(
        Datetime(title=_("The date on which this subscription was created."),
                 required=False,
                 readonly=True))
    date_last_updated = exported(
        Datetime(
            title=_("The date on which this subscription was last updated."),
            required=False,
            readonly=True))

    target = exported(
        Reference(
            schema=Interface,  # IStructuralSubscriptionTarget
            required=True,
            readonly=True,
            title=_("The structure to which this subscription belongs.")))

    bug_filters = exported(
        CollectionField(
            title=_('List of bug filters that narrow this subscription.'),
            readonly=True,
            required=False,
            value_type=Reference(schema=Interface)))  # IBugSubscriptionFilter
Example #21
0
class IPersonTransferJob(IRunnableJob):
    """A Job related to team membership or a person merge."""

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

    job = Object(title=_('The common Job attributes'),
                 schema=IJob,
                 required=True)

    minor_person = PublicPersonChoice(
        title=_('The person being added to the major person/team'),
        vocabulary='ValidPersonOrTeam',
        required=True)

    major_person = PublicPersonChoice(
        title=_('The person or team receiving the minor person'),
        vocabulary='ValidPersonOrTeam',
        required=True)

    metadata = Attribute('A dict of data about the job.')
Example #22
0
class IRevisionAuthor(Interface):
    """Committer of a Bazaar revision."""

    name = TextLine(title=_("Revision Author Name"), required=True)
    name_without_email = Attribute(
        "Revision author name without email address.")
    email = Attribute("The email address extracted from the author text.")
    person = PublicPersonChoice(title=_('Author'),
                                required=False,
                                readonly=False,
                                vocabulary='ValidPersonOrTeam')
    personID = Attribute("The primary key of the person")

    def linkToLaunchpadPerson():
        """Attempt to link the revision author to a Launchpad `Person`.
Example #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.")))
Example #24
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.'))
Example #25
0
    def _createTeamAnswerContactsField(self):
        """Create a list of teams the user is an administrator of."""
        sort_key = attrgetter('displayname')
        terms = []
        for team in sorted(self.administrated_teams, key=sort_key):
            terms.append(SimpleTerm(team, team.name, team.displayname))

        public_person_choice = PublicPersonChoice(
            vocabulary=SimpleVocabulary(terms))
        return form.FormField(
            List(__name__='answer_contact_teams',
                 title=_(
                     "Let the following teams be an answer contact for "
                     "$context",
                     mapping=dict(context=self.context.displayname)),
                 value_type=public_person_choice,
                 required=False))
Example #26
0
    def _createRegistrantField(self):
        """Return a popup widget person selector for the registrant.

        This custom field is necessary because *normally* the registrant is
        read-only but we want the admins to have the ability to correct legacy
        data that was set before the registrant field existed.
        """
        return form.Fields(PublicPersonChoice(
            __name__='registrant',
            title=_('Project Registrant'),
            description=_('The person who originally registered the '
                          'project group.  Distinct from the current '
                          'owner.  This is historical data and should '
                          'not be changed without good cause.'),
            vocabulary='ValidPersonOrTeam',
            required=True,
            readonly=False,
        ),
                           render_context=self.render_context)
Example #27
0
class IGitRuleGrantView(Interface):
    """`IGitRuleGrant` attributes that require launchpad.View."""

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

    repository = Reference(
        title=_("Repository"), required=True, readonly=True,
        schema=IGitRepository,
        description=_("The repository that this grant is for."))

    rule = Reference(
        title=_("Rule"), required=True, readonly=True,
        schema=IGitRule,
        description=_("The rule that this grant is for."))

    grantor = PublicPersonChoice(
        title=_("Grantor"), required=True, readonly=True,
        vocabulary="ValidPerson",
        description=_("The user who created this grant."))

    grantee_type = Choice(
        title=_("Grantee type"), required=True, readonly=True,
        vocabulary=GitGranteeType,
        description=_("The type of grantee for this grant."))

    grantee = PersonChoice(
        title=_("Grantee"), required=False, readonly=True,
        vocabulary="ValidPersonOrTeam",
        description=_("The person being granted access."))

    combined_grantee = Attribute(
        "The overall grantee of this grant: either a `GitGranteeType` (other "
        "than `PERSON`) or an `IPerson`.")

    date_created = Datetime(
        title=_("Date created"), required=True, readonly=True,
        description=_("The time when this grant was created."))

    date_last_modified = Datetime(
        title=_("Date last modified"), required=True, readonly=True,
        description=_("The time when this grant was last modified."))
class ICodeReviewVoteReferencePublic(Interface):
    """The public attributes for code review vote references."""

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

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

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

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

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

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

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

    is_pending = exported(
        Bool(title=_("Is the pending?"), required=True, readonly=True))
Example #29
0
class IGitRepositoryModerateAttributes(Interface):
    """IGitRepository attributes that can be edited by more than one community.
    """

    date_last_modified = exported(
        Datetime(title=_("Date last modified"), required=True, readonly=True))

    reviewer = exported(
        PublicPersonChoice(
            title=_("Review Team"),
            required=False,
            readonly=False,
            vocabulary="ValidBranchReviewer",
            description=_("The reviewer of a repository is the person or "
                          "exclusive team that is responsible for reviewing "
                          "proposals and merging into this repository.")))

    description = exported(
        Text(title=_("Description"),
             required=False,
             readonly=False,
             description=_("A short description of this repository.")))
class ICodeImportEvent(Interface):
    """One event in the code-import audit trail."""

    id = Int(readonly=True, required=True)
    date_created = Datetime(title=_("Date Created"),
                            required=True,
                            readonly=True)

    event_type = Choice(title=_("Event"),
                        required=True,
                        readonly=True,
                        vocabulary=CodeImportEventType,
                        description=_("The type of this event."
                                      ""))
    code_import = Choice(title=_("Code Import"),
                         required=False,
                         readonly=True,
                         vocabulary='CodeImport',
                         description=_(
                             "The code import affected by this event."
                             ""))
    person = PublicPersonChoice(title=_("Person"),
                                required=False,
                                readonly=True,
                                vocabulary='Person',
                                description=_(
                                    "The person that triggered this event."
                                    ""))
    machine = Choice(title=_("Machine"),
                     required=False,
                     readonly=True,
                     vocabulary='CodeImportMachine',
                     description=_(
                         "The import machine where this event occured."
                         ""))

    def items():
        """List of key-value tuples recording additional information.