def num_open(rt, day): o = rt.ticket.search(and_([ rt.ticket.c.Created < day, or_([rt.ticket.c.Status!='resolved', rt.ticket.c.Resolved > day]) ])) return len(o)
def report(rt, queue, start_date,outfile): tickets = rt.ticket.search(and_([rt.ticket.c.queue==queue, rt.ticket.c.created>=start_date]),format='l') f = open(outfile, 'w') c = csv.writer(f) c.writerow("id subject requestors creator created resolved".split()) for t in tickets: c.writerow((t.id, t.Subject, t.Requestors, t.Creator, t.Created, t.Resolved)) f.close()