Exemplo n.º 1
0
def main(reactor, *argv):
    config = Options()
    config.parseOptions(argv[1:])

    if config.subCommand == 'list':
        return (connect(reactor, config['port']).addCallback(
            Client.fetchTicket, config['id']).addCallback(listAttachments))
    elif config.subCommand == 'get':
        if config.subOptions['filename']:
            return (getRawAttachment(
                config.subOptions['id'],
                config.subOptions['filename']).addCallback(
                    sys.__stdout__.write))
        else:
            return (connect(reactor, config['port']).addCallback(
                Client.fetchTicket,
                config['id']).addCallback(getLastAttachment).addCallback(
                    sys.__stdout__.write))
    elif config.subCommand == 'apply':

        def apply(ticket):
            return (getLastAttachment(ticket).addCallback(
                applyPatch, reactor, config, ticket))

        return (connect(reactor, config['port']).addCallback(
            Client.fetchTicket, config['id']).addCallback(apply))
Exemplo n.º 2
0
def main(reactor, *argv):
    config = Options()
    config.parseOptions(argv[1:])
    def fetch(client):
        return client.fetchTicket(config['id'], asHTML=False).addCallback(formatTicket)

    return connect(reactor, config['port']).addCallback(fetch)
Exemplo n.º 3
0
def main(reactor, *argv):
    config = Options()
    config.parseOptions(argv[1:])
    def fetch(client):
        return client.reviewTickets().addCallback(formatTickets)

    return connect(reactor, config['port']).addCallback(fetch)
Exemplo n.º 4
0
def main(reactor, *argv):
    config = Options()
    config.parseOptions(argv[1:])

    def fetch(client):
        return client.reviewTickets().addCallback(formatTickets)

    return connect(reactor, config['port']).addCallback(fetch)
Exemplo n.º 5
0
def main(reactor, *argv):
    config = Options()
    config.parseOptions(argv[1:])

    def fetch(client):
        return client.fetchTicket(config['id'],
                                  asHTML=False).addCallback(formatTicket)

    return connect(reactor, config['port']).addCallback(fetch)
Exemplo n.º 6
0
def main(reactor, *argv):
    config = Options()
    config.parseOptions(argv[1:])

    if config.subCommand == 'list':
        return (connect(reactor, config['port'])
                .addCallback(Client.fetchTicket, config['id'])
                .addCallback(listAttachments))
    elif config.subCommand == 'get':
        if config.subOptions['filename']:
            return (getRawAttachment(config.subOptions['id'], config.subOptions['filename'])
                    .addCallback(sys.__stdout__.write))
        else:
            return (connect(reactor, config['port'])
                    .addCallback(Client.fetchTicket, config['id'])
                    .addCallback(getLastAttachment)
                    .addCallback(sys.__stdout__.write))
    elif config.subCommand == 'apply':
        def apply(ticket):
            return (getLastAttachment(ticket)
                    .addCallback(applyPatch, reactor, config, ticket))
        return (connect(reactor, config['port'])
                .addCallback(Client.fetchTicket, config['id'])
                .addCallback(apply))
Exemplo n.º 7
0
    def reportReviewTickets(self, trackerRoot, channel):
        """
        Retrieve the list of tickets currently up for review from the
        tracker at the given location and report them to the given channel.

        @param trackerRoot: The base URL of the trac instance from which to
        retrieve ticket information.  C{"http://example.com/trac/"}, for
        example.

        @param channel: The channel to which to send the results.

        @return: A Deferred which fires when the report has been completed.
        """
        if amptrac is None:
            f = failure.Failure(amptracError)
            log.err(f, "amptrac not present, can't report tickets.")
            return defer.fail(f)

        d = amptrac.connect(reactor, port=config.AMPTRAC_PORT)
        d.addCallback(self._getReviewTickets)
        d.addCallback(self._reportReviewTickets, channel)
        return d
Exemplo n.º 8
0
    def reportReviewTickets(self, trackerRoot, channel):
        """
        Retrieve the list of tickets currently up for review from the
        tracker at the given location and report them to the given channel.

        @param trackerRoot: The base URL of the trac instance from which to
        retrieve ticket information.  C{"http://example.com/trac/"}, for
        example.

        @param channel: The channel to which to send the results.

        @return: A Deferred which fires when the report has been completed.
        """
        if amptrac is None:
            f = failure.Failure(amptracError)
            log.err(f, "amptrac not present, can't report tickets.")
            return defer.fail(f)

        d = amptrac.connect(reactor)
        d.addCallback(self._getReviewTickets)
        d.addCallback(self._reportReviewTickets, channel)
        return d