Commit db87277ac3a11b25c64b47004c4ad6fd55dcb678

Authored by carol15022
Committed by Sergio Oliveira
1 parent 74fb0ff3
Exists in trac_indexing

Applying flake8

Signed-off-by: Thiago Ribeiro <thagitosouza@hotmail.com>
colab/proxy/trac/data_api.py
@@ -15,7 +15,7 @@ class TracDataAPI(ProxyDataAPI): @@ -15,7 +15,7 @@ class TracDataAPI(ProxyDataAPI):
15 self.fetch_data_attachment(cursor) 15 self.fetch_data_attachment(cursor)
16 self.fetch_data_ticket(cursor) 16 self.fetch_data_ticket(cursor)
17 self.fetch_data_revision(cursor) 17 self.fetch_data_revision(cursor)
18 - 18 +
19 def fetch_data_attachment(self, cursor): 19 def fetch_data_attachment(self, cursor):
20 attachment = Attachment() 20 attachment = Attachment()
21 cursor.execute(''' SELECT * from attachment; ''') 21 cursor.execute(''' SELECT * from attachment; ''')
@@ -32,7 +32,7 @@ class TracDataAPI(ProxyDataAPI): @@ -32,7 +32,7 @@ class TracDataAPI(ProxyDataAPI):
32 + "/" + attachment.filename 32 + "/" + attachment.filename
33 local_time = line['time']/1000000 33 local_time = line['time']/1000000
34 attachment.modified = time.strftime('%Y-%m-%d %H:%M:%S', 34 attachment.modified = time.strftime('%Y-%m-%d %H:%M:%S',
35 - time.localtime(local_time)) 35 + time.localtime(local_time))
36 if match("\.(\w+)$", attachment.filename): 36 if match("\.(\w+)$", attachment.filename):
37 attachment.mimetype = attachment.filename.lower() 37 attachment.mimetype = attachment.filename.lower()
38 attachment.save() 38 attachment.save()
@@ -52,7 +52,7 @@ class TracDataAPI(ProxyDataAPI): @@ -52,7 +52,7 @@ class TracDataAPI(ProxyDataAPI):
52 revision.created = time.strftime('%Y-%m-%d %H:%M:%S', 52 revision.created = time.strftime('%Y-%m-%d %H:%M:%S',
53 time.localtime(local_time)) 53 time.localtime(local_time))
54 revision.repository_name = repository_dict[line['value']] 54 revision.repository_name = repository_dict[line['value']]
55 - 55 +
56 def fetch_data_ticket(self, cursor): 56 def fetch_data_ticket(self, cursor):
57 ticket = Ticket() 57 ticket = Ticket()
58 collaborators = [] 58 collaborators = []
@@ -74,13 +74,12 @@ class TracDataAPI(ProxyDataAPI): @@ -74,13 +74,12 @@ class TracDataAPI(ProxyDataAPI):
74 ticket.author = ticket.reporter 74 ticket.author = ticket.reporter
75 local_time = line['time']/1000000 75 local_time = line['time']/1000000
76 ticket.created = time.strftime('%Y-%m-%d %H:%M:%S', 76 ticket.created = time.strftime('%Y-%m-%d %H:%M:%S',
77 - time.localtime(local_time)) 77 + time.localtime(local_time))
78 ticket.modified = str(timezone.now()) 78 ticket.modified = str(timezone.now())
79 ticket.modified_by = ticket.author 79 ticket.modified_by = ticket.author
80 if line['report'] not in collaborators: 80 if line['report'] not in collaborators:
81 - collaborators.append(line['report']) 81 + collaborators.append(line['report'])
82 ticket.collaborators = collaborators 82 ticket.collaborators = collaborators
83 -  
84 83
85 def fetch_data_wiki(self, cursor): 84 def fetch_data_wiki(self, cursor):
86 wiki = Wiki() 85 wiki = Wiki()
colab/proxy/trac/models.py
@@ -60,7 +60,7 @@ class Revision(models.Model, HitCounterModelMixin): @@ -60,7 +60,7 @@ class Revision(models.Model, HitCounterModelMixin):
60 repository_name = models.TextField(blank=True) 60 repository_name = models.TextField(blank=True)
61 created = models.DateTimeField(blank=True, null=True) 61 created = models.DateTimeField(blank=True, null=True)
62 modified = models.DateTimeField(blank=True, null=True) 62 modified = models.DateTimeField(blank=True, null=True)
63 - 63 +
64 @property 64 @property
65 def title(self): 65 def title(self):
66 return u'{} [{}]'.format(self.repository_name, self.rev) 66 return u'{} [{}]'.format(self.repository_name, self.rev)
@@ -99,17 +99,17 @@ class Ticket(models.Model, HitCounterModelMixin): @@ -99,17 +99,17 @@ class Ticket(models.Model, HitCounterModelMixin):
99 created = models.DateTimeField(blank=True, null=True) 99 created = models.DateTimeField(blank=True, null=True)
100 modified = models.DateTimeField(blank=True, null=True) 100 modified = models.DateTimeField(blank=True, null=True)
101 modified_by = models.TextField(blank=True) 101 modified_by = models.TextField(blank=True)
102 - 102 +
103 @property 103 @property
104 def title(self): 104 def title(self):
105 - return u'#{} - {}'.format(self.id, self.summary)  
106 - 105 + return u'#{} - {}'.format(self.id, self.summary)
  106 +
107 @property 107 @property
108 def description(self): 108 def description(self):
109 return u'{}\n{}\n{}\n{}\n{}\n{}\n{}'.format( 109 return u'{}\n{}\n{}\n{}\n{}\n{}\n{}'.format(
110 self.description, self.milestone, self.component, self.severity, 110 self.description, self.milestone, self.component, self.severity,
111 self.reporter, self.keywords, self.collaborators 111 self.reporter, self.keywords, self.collaborators
112 - ) 112 + )
113 113
114 class Meta: 114 class Meta:
115 verbose_name = _('Attachment') 115 verbose_name = _('Attachment')
@@ -143,7 +143,7 @@ class Wiki(Collaboration, HitCounterModelMixin): @@ -143,7 +143,7 @@ class Wiki(Collaboration, HitCounterModelMixin):
143 143
144 @property 144 @property
145 def description(self): 145 def description(self):
146 - return u'{}\n{}'.format(self.wiki_text, self.collaborators) 146 + return u'{}\n{}'.format(self.wiki_text, self.collaborators)
147 147
148 class Meta: 148 class Meta:
149 verbose_name = _('Attachment') 149 verbose_name = _('Attachment')