Exemplo n.º 1
0
def list_(args):
    """List the tracker's issues (filtered by criteria)"""
    t = args['tracker']
    c = UserConfig()
    query = Query(t)
    args.setdefault('order', 'updated')
    args.setdefault('status', 'open')
    issues = query.select(order_by=args['order'], status=args['status'])
    # short mode
    if args['short']:
        for i in issues:
            print '%s %s' % (c.decorate('red', i.id[:6]), i.title)
    # normal mode
    else:
        for i in issues:
            print '%s %s' % (c.decorate('red', 'issue'), i.id)
            print '%s  %s <%s>' % (c.decorate(
                'yellow', 'Author:'), i.author['name'], i.author['email'])
            print '%s %s' % (c.decorate('yellow',
                                        'Created:'), relative_time(i.created))
            if i.updated != i.created:
                print '%s %s' % (c.decorate(
                    'yellow', 'Updated:'), relative_time(i.updated))
            print '%s  %s' % (c.decorate('yellow', 'Status:'), i.status)

            num_comments = len(i.comments())
            if num_comments:
                print '%d Comments' % num_comments
            print
            print '    ' + c.decorate('bold', i.title)
            print
            content = wrap(i.content)
            for line in content.splitlines():
                print '    ' + line
            print
Exemplo n.º 2
0
    def issues(self, **kwargs):
        """
        Return issues, with options to limit, offset, sort, and filter the result set.

        This method is a handoff to Query.select(), here for convenience. Both methods
        take the same paramters.

        :param order_by: order the results by this column.
        :param status: return results with this status.
        :param limit: maximum number of results to return.
        :param offset: skip the first n-results. 
        :param reverse: results are returned in ascending order if True, 
                        descending if False.
        """
        query = Query(self)
        return query.select(**kwargs)
Exemplo n.º 3
0
 def query(self):
     """
     Returns a hopper.query.Query object for querying the issue 
     database.
     """
     return Query(self)