Commit 87ab9ed3daf35973dd954b5462aef858bbff56f8

Authored by Thiago Ribeiro
Committed by Sergio Oliveira
1 parent d1726b36

Apply Revision

Signed-off-by: Thiago Ribeiro <thiagitosouza@hotmail.com>
colab/proxy/trac/data_api.py
@@ -76,7 +76,8 @@ class TracDataAPI(ProxyDataAPI): @@ -76,7 +76,8 @@ class TracDataAPI(ProxyDataAPI):
76 revision.message = line['message'] 76 revision.message = line['message']
77 revision.description = revision.message 77 revision.description = revision.message
78 revision.created = self.get_revision_created(cursor, line['rev']) 78 revision.created = self.get_revision_created(cursor, line['rev'])
79 - revision.repository_name = repository_dict[line['repos']] 79 + revision.repository_name = line['repos']
  80 + revision.save()
80 81
81 def fetch_data_ticket(self, empty_cursor): 82 def fetch_data_ticket(self, empty_cursor):
82 """ This method is responsible for seeking the ticket data in 83 """ This method is responsible for seeking the ticket data in
@@ -106,16 +107,24 @@ class TracDataAPI(ProxyDataAPI): @@ -106,16 +107,24 @@ class TracDataAPI(ProxyDataAPI):
106 ticket.reporter = line['reporter'] 107 ticket.reporter = line['reporter']
107 ticket.status = line['status'] 108 ticket.status = line['status']
108 ticket.tag = ticket.status 109 ticket.tag = ticket.status
109 - ticket.keywords = line['keywords']  
110 - ticket.owner = line['owner']  
111 - ticket.resolution = line['resolution'] 110 + if line['keywords']:
  111 + ticket.keywords = line['keywords']
  112 + if line['owner']:
  113 + ticket.owner = line['owner']
  114 + else:
  115 + ticket.owner = 'Anonymous'
  116 + if line['resolution']:
  117 + ticket.resolution = line['resolution']
  118 + else:
  119 + ticket.resolution = 'no resolution'
112 ticket.author = ticket.reporter 120 ticket.author = ticket.reporter
113 ticket.created = self.get_ticket_created(cursor, line['id']) 121 ticket.created = self.get_ticket_created(cursor, line['id'])
114 ticket.modified = self.get_ticket_modified(cursor, line['id']) 122 ticket.modified = self.get_ticket_modified(cursor, line['id'])
115 - ticket.modified_by = ticket.author  
116 if line['reporter'] not in collaborators: 123 if line['reporter'] not in collaborators:
117 collaborators.append(line['reporter']) 124 collaborators.append(line['reporter'])
118 ticket.collaborators = collaborators 125 ticket.collaborators = collaborators
  126 + ticket.update_user(ticket.author)
  127 + ticket.save()
119 128
120 def fetch_data_wiki(self, empty_cursor): 129 def fetch_data_wiki(self, empty_cursor):
121 """ This method is responsible for seeking the wiki data in 130 """ This method is responsible for seeking the wiki data in
@@ -136,7 +145,7 @@ class TracDataAPI(ProxyDataAPI): @@ -136,7 +145,7 @@ class TracDataAPI(ProxyDataAPI):
136 for line in wiki_dict: 145 for line in wiki_dict:
137 wiki.update_user(line['author']) 146 wiki.update_user(line['author'])
138 wiki.title = line['name'] 147 wiki.title = line['name']
139 - wiki.text = line['text'] 148 + wiki.wiki_text = line['text']
140 wiki.author = line['author'] 149 wiki.author = line['author']
141 if line['author'] not in collaborators: 150 if line['author'] not in collaborators:
142 collaborators.append(line['author']) 151 collaborators.append(line['author'])
colab/proxy/trac/models.py
@@ -49,7 +49,6 @@ class Attachment(models.Model, HitCounterModelMixin): @@ -49,7 +49,6 @@ class Attachment(models.Model, HitCounterModelMixin):
49 except User.DoesNotExist: 49 except User.DoesNotExist:
50 return None 50 return None
51 51
52 -  
53 class Revision(models.Model, HitCounterModelMixin): 52 class Revision(models.Model, HitCounterModelMixin):
54 update_field = 'created' 53 update_field = 'created'
55 icon_name = 'align-right' 54 icon_name = 'align-right'
@@ -78,7 +77,7 @@ class Revision(models.Model, HitCounterModelMixin): @@ -78,7 +77,7 @@ class Revision(models.Model, HitCounterModelMixin):
78 return None 77 return None
79 78
80 79
81 -class Ticket(models.Model, HitCounterModelMixin): 80 +class Ticket(Collaboration, HitCounterModelMixin):
82 icon_name = 'tag' 81 icon_name = 'tag'
83 type = 'ticket' 82 type = 'ticket'
84 summary = models.TextField(blank=True) 83 summary = models.TextField(blank=True)
@@ -96,7 +95,6 @@ class Ticket(models.Model, HitCounterModelMixin): @@ -96,7 +95,6 @@ class Ticket(models.Model, HitCounterModelMixin):
96 collaborators = models.TextField(blank=True) 95 collaborators = models.TextField(blank=True)
97 created = models.DateTimeField(blank=True, null=True) 96 created = models.DateTimeField(blank=True, null=True)
98 modified = models.DateTimeField(blank=True, null=True) 97 modified = models.DateTimeField(blank=True, null=True)
99 - modified_by = models.TextField(blank=True)  
100 owner = models.TextField(blank=True) 98 owner = models.TextField(blank=True)
101 resolution = models.TextField(blank=True) 99 resolution = models.TextField(blank=True)
102 100
colab/proxy/trac/templates/search/indexes/trac/attachment_text.txt 0 → 100644
@@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
  1 +{{ object.filename }}
  2 +{{ object.filename|slugify }}
  3 +{{ object.description }}
  4 +{{ object.description|slugify }}
  5 +{{ object.used_by }}
  6 +{{ object.mimetype }}
  7 +{{ object.get_author.get_full_name }}
  8 +
  9 +{% for k, v in extracted.metadata.items %}
  10 + {% for val in v %}
  11 + {{ k }}: {{ val|safe }}
  12 + {% endfor %}
  13 +{% endfor %}
  14 +
  15 +{{ extracted.contents|striptags|safe }}
colab/proxy/trac/templates/search/indexes/trac/revision_text.txt 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +{{ object.repository_name }}
  2 +{{ object.repository_name|slugify }}
  3 +{{ object.rev }}
  4 +{{ object.rev|slugify }}
  5 +{% firstof object.get_author.get_full_name object.author %}
  6 +{% firstof object.get_author.get_full_name|slugify object.author|slugify %}
  7 +{{ object.message }}
  8 +{{ object.message|slugify }}
colab/proxy/trac/templates/search/indexes/trac/ticket_text.txt 0 → 100644
@@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
  1 +{{ object.summary }}
  2 +{{ object.summary|slugify }}
  3 +{{ object.description }}
  4 +{{ object.description|slugify }}
  5 +{{ object.milestone }}
  6 +{{ object.milestone|slugify }}
  7 +{{ object.component|slugify }}
  8 +{{ object.version }}
  9 +{{ object.severity }}
  10 +{{ object.severity|slugify }}
  11 +{{ object.reporter }}
  12 +{{ object.reporter|slugify }}
  13 +{% firstof object.get_author.get_fullname or object.author %}
  14 +{% firstof object.get_author.get_fullname|slugify or object.author|slugify %}
  15 +{{ object.status }}
  16 +{{ object.status|slugify }}
  17 +{{ object.keywords }}
  18 +{{ object.keywords|slugify }}
  19 +{{ object.collaborators }}
  20 +{{ object.collaborators|slugify }}
docs/source/user.rst
@@ -30,6 +30,8 @@ Since Trac already installed: @@ -30,6 +30,8 @@ Since Trac already installed:
30 30
31 To enable Trac plugin must first configure the trac database in /etc/colab/settings.yml: 31 To enable Trac plugin must first configure the trac database in /etc/colab/settings.yml:
32 32
  33 +1. vim /etc/colab/settings.yaml
  34 +
33 .. code-block:: yaml 35 .. code-block:: yaml
34 36
35 DATABASES: 37 DATABASES:
@@ -39,12 +41,12 @@ To enable Trac plugin must first configure the trac database in /etc/colab/setti @@ -39,12 +41,12 @@ To enable Trac plugin must first configure the trac database in /etc/colab/setti
39 NAME: colab 41 NAME: colab
40 USER: colab 42 USER: colab
41 PASSWORD: colab 43 PASSWORD: colab
42 - trac:  
43 - ENGINE: django.db.backends.postgresql_psycopg2  
44 - HOST: localhost  
45 - NAME: trac  
46 - USER: colab  
47 - PASSWORD: colab 44 + trac:
  45 + ENGINE: django.db.backends.postgresql_psycopg2
  46 + HOST: localhost
  47 + NAME: trac
  48 + USER: colab
  49 + PASSWORD: colab
48 50
49 - Yet this file uncomment in PROXIED_APPS the Trac: 51 - Yet this file uncomment in PROXIED_APPS the Trac:
50 52
@@ -68,16 +70,16 @@ To enable Trac plugin must first configure the trac database in /etc/colab/setti @@ -68,16 +70,16 @@ To enable Trac plugin must first configure the trac database in /etc/colab/setti
68 70
69 .. code-block:: sh 71 .. code-block:: sh
70 72
71 - # Since you are in the folder colab 73 + # Since you are in the folder colab
72 $ workon colab 74 $ workon colab
73 - $ colab-admin makemigrations trac  
74 - $ colab-admin migrate 75 + $ colab-admin makemigrations
  76 + $ colab-admin migrate trac
75 77
76 - Finally, just import the Trac data (may take a few minutes): 78 - Finally, just import the Trac data (may take a few minutes):
77 79
78 .. code-block:: sh 80 .. code-block:: sh
79 81
80 - # Since you are in the folder colab 82 + # Since you are in the folder colab
81 $ colab-admin import_proxy_data 83 $ colab-admin import_proxy_data
82 84
83 Settings 85 Settings