Commit 8cd115d7e09efa5ce7e0fb137ac7bffa31b6a60b

Authored by carol15022
Committed by Sergio Oliveira
1 parent 412f0e00

Add trac_ticket in colab

Signed-off-by: Thiago Ribeiro <thiagitosouza@hotmail.com>
Showing 1 changed file with 27 additions and 2 deletions   Show diff stats
colab/proxy/trac/data_api.py
... ... @@ -49,8 +49,33 @@ class TracDataAPI(ProxyDataAPI):
49 49 time.localtime(local_time))
50 50 revision.repository_name = repository_dict[line['value']]
51 51  
52   - #def fetch_data_ticket(self, cursor)
53   - # ticket = Ticket()
  52 + def fetch_data_ticket(self, cursor):
  53 + ticket = Ticket()
  54 + collaborators = []
  55 + cursor.execute('''SELECT * FROM ticket;''')
  56 + ticket_dict = self.dictfetchall(cursor)
  57 + for line in ticket_dict:
  58 + ticket.id = line['id']
  59 + ticket.summary = line['summary']
  60 + ticket.description = line['description']
  61 + ticket.milestone = line['milestone']
  62 + ticket.priority = line['priority']
  63 + ticket.component = line['component']
  64 + ticket.version = line['version']
  65 + ticket.severity = line['severity']
  66 + ticket.reporter = line['reporter']
  67 + ticket.status = line['status']
  68 + ticket.keywords = line['keywords']
  69 + ticket.author = ticket.reporter
  70 + local_time = line['time']/1000000
  71 + ticket.created = time.strftime('%Y-%m-%d %H:%M:%S',
  72 + time.localtime(local_time))
  73 + ticket.modified = str(timezone.now())
  74 + ticket.modified_by = ticket.author
  75 + if line['report'] not in collaborators:
  76 + collaborators.append(line['report'])
  77 + ticket.collaborators = collaborators
  78 +
54 79  
55 80 def fetch_data_wiki(self, cursor):
56 81 wiki = Wiki()
... ...