Exemplo n.º 1
0
class IAddBugTaskWithUpstreamLinkForm(IAddBugTaskForm):
    """Form for adding an upstream bugtask with linking options.

    The choices in link_upstream_how correspond to zero or one of the
    text fields. For example, if link_upstream_how is LINK_UPSTREAM
    then bug_url is the relevant field, and the other text fields,
    like upstream_email_address_done, can be ignored.

    That also explains why none of the text fields are required. That
    check is left to the view, in part so that better error messages
    can be provided.
    """
    # link_upstream_how must have required=False, since
    # ProductBugTaskCreationStep doesn't always display a form input for it.
    link_upstream_how = Choice(
        title=_('How'), required=False,
        vocabulary=LinkUpstreamHowOptions,
        default=LinkUpstreamHowOptions.LINK_UPSTREAM,
        description=_("How to link to an upstream bug."))
    bug_url = StrippedTextLine(
        title=_('Bug URL'), required=False, constraint=valid_remote_bug_url,
        description=_("The URL of this bug in the remote bug tracker."))
    upstream_email_address_done = StrippedTextLine(
        title=_('Email Address'), required=False, constraint=email_validator,
        description=_("The upstream email address that this bug has been "
                      "forwarded to."))
Exemplo n.º 2
0
class IAddBugTaskWithProductCreationForm(ILinkPackaging):

    bug_url = StrippedTextLine(
        title=_('Bug URL'), required=True, constraint=valid_remote_bug_url,
        description=_("The URL of this bug in the remote bug tracker."))
    displayname = TextLine(title=_('Project name'))
    name = ProductNameField(
        title=_('Project ID'), constraint=name_validator, required=True,
        description=_(
            "A short name starting with a lowercase letter or number, "
            "followed by letters, dots, hyphens or plusses. e.g. firefox, "
            "linux, gnome-terminal."))
    summary = Summary(title=_('Project summary'), required=True)
Exemplo n.º 3
0
class IAccountPublic(Interface):
    """Public information on an `IAccount`."""

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

    displayname = StrippedTextLine(
        title=_('Display Name'),
        required=True,
        readonly=False,
        description=_("Your name as you would like it displayed."))

    status = AccountStatusChoice(title=_("The status of this account"),
                                 required=True,
                                 readonly=False,
                                 vocabulary=AccountStatus)
Exemplo n.º 4
0
class IRemoteBug(Interface):
    """A remote bug for a given bug tracker."""

    bugtracker = Choice(title=_('Bug System'), required=True,
        vocabulary='BugTracker', description=_("The bug tracker in which "
        "the remote bug is found."))

    remotebug = StrippedTextLine(title=_('Remote Bug'), required=True,
        readonly=False, description=_("The bug number of this bug in the "
        "remote bug system."))

    bugs = Attribute(
        _("A list of the Launchpad bugs watching the remote bug."))

    title = TextLine(
        title=_('Title'),
        description=_('A descriptive label for this remote bug'))
Exemplo n.º 5
0
class IAddBugTaskForm(ILinkPackaging):
    """Form for adding an upstream bugtask."""
    # It is tempting to replace the first three attributes here with their
    # counterparts from IUpstreamBugTask and IDistroBugTask.
    # BUT: This will cause OOPSes with adapters, hence IAddBugTask reinvents
    # the wheel somewhat. There is a test to ensure that this remains so.
    product = Choice(title=_('Project'), required=True, vocabulary='Product')
    distribution = Choice(
        title=_("Distribution"), required=True, vocabulary='Distribution')
    sourcepackagename = Choice(
        title=_("Source Package Name"), required=False,
        description=_("The source package in which the bug occurs. "
                      "Leave blank if you are not sure."),
        vocabulary='SourcePackageName')
    bug_url = StrippedTextLine(
        title=_('URL'), required=False, constraint=valid_remote_bug_url,
        description=_("The URL of this bug in the remote bug tracker."))
Exemplo n.º 6
0
    def __init__(self, field, vocabulary, request):
        LaunchpadRadioWidget.__init__(self, field, vocabulary, request)

        # Bug tracker widget.
        self.bugtracker = Choice(vocabulary="WebBugTracker",
                                 __name__='bugtracker')
        self.bugtracker_widget = CustomWidgetFactory(BugTrackerPickerWidget)
        setUpWidget(self,
                    'bugtracker',
                    self.bugtracker,
                    IInputWidget,
                    prefix=self.name,
                    value=field.context.bugtracker,
                    context=field.context)
        self.bugtracker_widget.onKeyPress = ("selectWidget('%s.2', event);" %
                                             self.name)

        # Upstream email address field and widget.
        ## This is to make email address bug trackers appear
        ## separately from the main bug tracker list.
        self.upstream_email_address = StrippedTextLine(
            required=False,
            constraint=email_validator,
            __name__='upstream_email_address')
        self.upstream_email_address_widget = (
            CustomWidgetFactory(StrippedTextWidget))
        setUpWidget(self,
                    'upstream_email_address',
                    self.upstream_email_address,
                    IInputWidget,
                    prefix=self.name,
                    value='',
                    context=self.upstream_email_address.context)
        ## Select the corresponding radio option automatically if
        ## the user starts typing.
        if self.upstream_email_address_widget.extra is None:
            self.upstream_email_address_widget.extra = ''
        self.upstream_email_address_widget.extra += (
            ''' onkeypress="selectWidget('%s.3', event);"\n''' % self.name)
Exemplo n.º 7
0
class IBugWatch(IHasBug):
    """A bug on a remote system."""
    export_as_webservice_entry()

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

    # Actually refers to Bug; redefined in bug.py.
    bug = exported(
        Reference(title=_('Bug'),
                  schema=Interface,
                  required=True,
                  readonly=True))
    bugtracker = exported(ReferenceChoice(
        title=_('Bug System'),
        required=True,
        schema=IBugTracker,
        vocabulary='BugTracker',
        description=_("You can register new bug trackers from the Launchpad "
                      "Bugs home page.")),
                          exported_as='bug_tracker')
    remotebug = exported(StrippedTextLine(
        title=_('Remote Bug'),
        required=True,
        readonly=False,
        description=_(
            "The bug number of this bug in the remote bug tracker.")),
                         exported_as='remote_bug')
    remotestatus = exported(TextLine(title=_('Remote Status')),
                            exported_as='remote_status')
    remote_importance = exported(TextLine(title=_('Remote Importance')))
    lastchanged = exported(Datetime(title=_('Last Changed')),
                           exported_as='date_last_changed')
    lastchecked = exported(Datetime(title=_('Last Checked')),
                           exported_as='date_last_checked')
    last_error_type = exported(
        Choice(title=_('Last Error Type'), vocabulary=BugWatchActivityStatus))
    datecreated = exported(Datetime(title=_('Date Created'),
                                    required=True,
                                    readonly=True),
                           exported_as='date_created')
    owner = exported(
        Reference(title=_('Owner'),
                  required=True,
                  readonly=True,
                  schema=Interface))
    activity = Attribute('The activity history of this BugWatch.')
    next_check = exported(Datetime(title=_('Next Check')),
                          exported_as='date_next_checked')

    # Useful joins.
    bugtasks = exported(
        CollectionField(
            description=_(
                'The tasks which this watch will affect. '
                'In Launchpad, a bug watch can be linked to one or more '
                'tasks, and if it is linked and we notice a status change '
                'in the watched bug then we will try to update the '
                'Launchpad bug task accordingly.'),
            # value_type is redefined in bugtask.py, to use the right
            # interface.
            value_type=Reference(schema=Interface, )),
        exported_as='bug_tasks')

    # Properties.
    needscheck = Attribute(
        "A True or False indicator of whether or not "
        "this watch needs to be synchronised. The algorithm used considers "
        "the severity of the bug, as well as the activity on the bug, to "
        "ensure that we spend most effort on high-importance and "
        "high-activity bugs.")

    unpushed_comments = Attribute(
        "A set of comments on this BugWatch that need to be pushed to "
        "the remote bug tracker.")

    # Required for Launchpad pages.
    title = exported(Text(title=_('Bug watch title'), readonly=True))

    url = exported(
        Text(title=_('The URL at which to view the remote bug.'),
             readonly=True))

    can_be_rescheduled = Attribute(
        "A True or False indicator of whether or not this watch can be "
        "rescheduled.")

    def updateImportance(remote_importance, malone_importance):
        """Update the importance of the bug watch and any linked bug task.

        The lastchanged attribute gets set to the current time.
        """

    def updateStatus(remote_status, malone_status):
        """Update the status of the bug watch and any linked bug task.

        The lastchanged attribute gets set to the current time.
        """

    def destroySelf():
        """Delete this bug watch."""

    def hasComment(comment_id):
        """Return True if a comment has been imported for the BugWatch.

        If the comment has not been imported, return False.

        :param comment_id: The remote ID of the comment.
        """

    def addComment(comment_id, message):
        """Link and imported comment to the BugWatch.

        :param comment_id: The remote ID of the comment.

        :param message: The imported comment as a Launchpad Message object.
        """

    def getBugMessages(clauses):
        """Return all the `IBugMessage`s that reference this BugWatch.
        
        :param clauses: A iterable of Storm clauses to limit the messages.
        """

    def getImportedBugMessages():
        """Return all the `IBugMessage`s that have been imported."""

    def addActivity(result=None, message=None, oops_id=None):
        """Add an `IBugWatchActivity` record for this BugWatch."""

    def setNextCheck(next_check):
        """Set the next_check time of the watch.

        :raises: `BugWatchCannotBeRescheduled` if
                 `IBugWatch.can_be_rescheduled` is False.
        """

    def reset():
        """Completely reset the watch.