Commit 15d11378641b6c5ca529fd3b14c0b369ee973688

Authored by carol15022
Committed by Sergio Oliveira
1 parent 6961d1c2
Exists in trac_indexing

Fixing attachment according to Haystack

Signed-off-by: Thiago Ribeiro <thiagitosouza@hotmail.com>
colab/proxy/trac/data_api.py
... ... @@ -13,7 +13,9 @@ class TracDataAPI(ProxyDataAPI):
13 13 cursor = connection.cursor()
14 14 self.fetch_data_wiki(cursor)
15 15 self.fetch_data_attachment(cursor)
16   -
  16 + self.fetch_data_ticket(cursor)
  17 + self.fetch_data_revision(cursor)
  18 +
17 19 def fetch_data_attachment(self, cursor):
18 20 attachment = Attachment()
19 21 cursor.execute(''' SELECT * from attachment; ''')
... ... @@ -22,13 +24,14 @@ class TracDataAPI(ProxyDataAPI):
22 24 attachment.description = line['description']
23 25 attachment.id = line['attach_id']
24 26 attachment.filename = line['filemame']
  27 + attachment.title = attachment.filename
25 28 attachment.size = line['size']
26 29 attachment.author = line['author']
27 30 attachment.used_by = line['type']
28 31 attachment.url = attachment.user_by + "/" + attachment.id \
29 32 + "/" + attachment.filename
30 33 local_time = line['time']/1000000
31   - attachment.created = time.strftime('%Y-%m-%d %H:%M:%S',
  34 + attachment.modified = time.strftime('%Y-%m-%d %H:%M:%S',
32 35 time.localtime(local_time))
33 36 if match("\.(\w+)$", attachment.filename):
34 37 attachment.mimetype = attachment.filename.lower()
... ...
colab/proxy/trac/models.py
... ... @@ -13,13 +13,16 @@ from django.utils.translation import ugettext_lazy as _
13 13  
14 14  
15 15 class Attachment(models.Model, HitCounterModelMixin):
  16 + type = 'attachment'
  17 + icon_name = 'file'
16 18 url = models.TextField(primary_key=True)
17 19 attach_id = models.TextField()
18 20 used_by = models.TextField()
19 21 filename = models.TextField()
20 22 author = models.TextField(blank=True)
  23 + title = models.TextField(blank=True)
21 24 description = models.TextField(blank=True)
22   - created = models.DateTimeField(blank=True)
  25 + modified = models.DateTimeField(blank=True)
23 26 mimetype = models.TextField(blank=True)
24 27 size = models.IntegerField(blank=True)
25 28  
... ...