def render_view(user, passwd, args): conf = TracConfig(BASE % dict(project=args.project), user, passwd) ticketrpc = TracTicketXMLRPC(conf) ticket = ticketrpc.get(args.ticket_id) print """ ========= #%(id)s ========= URL: %(url)s Summary: %(summary)s""" % dict(id=ticket.id, url=ticket.url, summary=ticket.summary) if ticket.description: print """Description: %(description)s """ % dict(description=indent(ticket.description)) print "Estimated Hours: %(estimatedhours)s" % dict( estimatedhours=ticket.estimatedhours) comments = ticket.comments if comments: print "\n---- Comments ----" for comment in comments: print """ Comment #%(id)s by %(author)s: %(value)s""" % dict(id=comment.id, author=comment.author, value=indent(comment.comment)) print ""
def main(): parser = get_parser() parser.add_argument('ticket_id', metavar='ticket_id', type=int, help='Ticket ID') parser.add_argument('-a', '--action', dest='action', help='Action on ticket') args = parser.parse_args() BASE="https://dev.inigo-tech.com/trac/%(project)s" project = args.project user, passwd = get_auth(args.username, args.password) conf = TracConfig(BASE % dict(project=project), user, passwd) ticket_server = TracTicketXMLRPC(conf) ticket = ticket_server.get(args.ticket_id) print "URL: %s" % (ticket.url) print "Summary: %s" % (ticket.summary) available_actions = list(action_keys(ticket_server.available_actions( args.ticket_id))) if args.action and (args.action not in available_actions): print 'Invalid action "%s". Available actions are : %s' % (args.action, ' , '.join(available_actions)) return 1 components = ticket_server.components() #components = [field['options'] for field in fields if field['name']=='component'][0] milestones = ticket_server.milestones() hours = raw_input("Effective hours: ") comment = editor_input("Please enter a comment above") print "\n\n====================\n" print "URL: %s" % ticket.url print "Summary : %s" % ticket.summary print "Effective Hours: %s" % hours print "Comment\t:\n%s" % (indent(comment)) proceed = raw_input("Is this correct? (y/n)") if proceed.strip().lower()[0] != 'y': return #propertykeys = ['status', 'totalhours', 'description', 'reporter', 'cc', 'milestone', 'component', 'summary', 'hours', 'owner', 'internal', 'billable', 'keywords', 'estimatedhours', 'type', 'priority'] if args.action: ticket.update(comment, hours=hours, action=args.action) else: ticket.update(comment, hours=hours) print "\nTicket %s updated" % ticket.url
def __init__(self, username, password): self.username = username self.rpc = {} for name, url in self.urls.items(): conf = TracConfig(url, username, password) self.rpc[name] = TracTicketXMLRPC(conf)
def main(): parser = get_parser() args = parser.parse_args() BASE="https://dev.inigo-tech.com/trac/%(project)s" project = args.project user, passwd = get_auth(args.username, args.password) conf = TracConfig(BASE % dict(project=project), user, passwd) ticket_server = TracTicketXMLRPC(conf) components = ticket_server.components() #components = [field['options'] for field in fields if field['name']=='component'][0] milestones = ticket_server.milestones() summary = raw_input("Summary: ") hours = raw_input("Effective hours: ") component = selection_input("Select component: ",components) milestone = selection_input("Select milestone: ",milestones) description = editor_input("Please enter a description above") print "\n\n====================\n" print "Summary : %s" % summary print "Effective Hours: %s" % hours print "Component: %s" % component print "Milestone: %s" % milestone print "Description\t:\n\n%s" % (" %s" % description.replace('\n','\n ')) proceed = raw_input("Is this correct? (y/n)") if proceed.strip().lower()[0] != 'y': return #propertykeys = ['status', 'totalhours', 'description', 'reporter', 'cc', 'milestone', 'component', 'summary', 'hours', 'owner', 'internal', 'billable', 'keywords', 'estimatedhours', 'type', 'priority'] tid = ticket_server.create(summary,description + '\n\n TimeTracker : New Ticket', component=component, milestone=milestone) ticket = ticket_server.get(tid) ticket.update('TimeTracker : Adding time and closing ticket', hours=hours, action='resolve') print "\nTicket created at %s/ticket/%s and closed" % (BASE % dict(project=project),tid)
def ticket_list(user, passwd, args): result = [] conf = TracConfig(BASE % dict(project=args.project), user, passwd) ticketrpc = TracTicketXMLRPC(conf) if args.filter_owner: tickets = ticketrpc.query(owner=user) # XXX: bad tickets = tickets + ticketrpc.query('cc~=%[email protected]' % user, 'owner!=%s' % user) else: tickets = ticketrpc.query() return tickets