Commit 87ab9ed3daf35973dd954b5462aef858bbff56f8

Authored by Thiago Ribeiro
Committed by Sergio Oliveira
1 parent d1726b36
Exists in trac_indexing

Apply Revision

Signed-off-by: Thiago Ribeiro <thiagitosouza@hotmail.com>
colab/proxy/trac/data_api.py
... ... @@ -76,7 +76,8 @@ class TracDataAPI(ProxyDataAPI):
76 76 revision.message = line['message']
77 77 revision.description = revision.message
78 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 82 def fetch_data_ticket(self, empty_cursor):
82 83 """ This method is responsible for seeking the ticket data in
... ... @@ -106,16 +107,24 @@ class TracDataAPI(ProxyDataAPI):
106 107 ticket.reporter = line['reporter']
107 108 ticket.status = line['status']
108 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 120 ticket.author = ticket.reporter
113 121 ticket.created = self.get_ticket_created(cursor, line['id'])
114 122 ticket.modified = self.get_ticket_modified(cursor, line['id'])
115   - ticket.modified_by = ticket.author
116 123 if line['reporter'] not in collaborators:
117 124 collaborators.append(line['reporter'])
118 125 ticket.collaborators = collaborators
  126 + ticket.update_user(ticket.author)
  127 + ticket.save()
119 128  
120 129 def fetch_data_wiki(self, empty_cursor):
121 130 """ This method is responsible for seeking the wiki data in
... ... @@ -136,7 +145,7 @@ class TracDataAPI(ProxyDataAPI):
136 145 for line in wiki_dict:
137 146 wiki.update_user(line['author'])
138 147 wiki.title = line['name']
139   - wiki.text = line['text']
  148 + wiki.wiki_text = line['text']
140 149 wiki.author = line['author']
141 150 if line['author'] not in collaborators:
142 151 collaborators.append(line['author'])
... ...
colab/proxy/trac/models.py
... ... @@ -49,7 +49,6 @@ class Attachment(models.Model, HitCounterModelMixin):
49 49 except User.DoesNotExist:
50 50 return None
51 51  
52   -
53 52 class Revision(models.Model, HitCounterModelMixin):
54 53 update_field = 'created'
55 54 icon_name = 'align-right'
... ... @@ -78,7 +77,7 @@ class Revision(models.Model, HitCounterModelMixin):
78 77 return None
79 78  
80 79  
81   -class Ticket(models.Model, HitCounterModelMixin):
  80 +class Ticket(Collaboration, HitCounterModelMixin):
82 81 icon_name = 'tag'
83 82 type = 'ticket'
84 83 summary = models.TextField(blank=True)
... ... @@ -96,7 +95,6 @@ class Ticket(models.Model, HitCounterModelMixin):
96 95 collaborators = models.TextField(blank=True)
97 96 created = models.DateTimeField(blank=True, null=True)
98 97 modified = models.DateTimeField(blank=True, null=True)
99   - modified_by = models.TextField(blank=True)
100 98 owner = models.TextField(blank=True)
101 99 resolution = models.TextField(blank=True)
102 100  
... ...
colab/proxy/trac/templates/search/indexes/trac/attachment_text.txt 0 → 100644
... ... @@ -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 @@
  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 @@
  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 30  
31 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 35 .. code-block:: yaml
34 36  
35 37 DATABASES:
... ... @@ -39,12 +41,12 @@ To enable Trac plugin must first configure the trac database in /etc/colab/setti
39 41 NAME: colab
40 42 USER: colab
41 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 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 70  
69 71 .. code-block:: sh
70 72  
71   - # Since you are in the folder colab
  73 + # Since you are in the folder colab
72 74 $ workon colab
73   - $ colab-admin makemigrations trac
74   - $ colab-admin migrate
  75 + $ colab-admin makemigrations
  76 + $ colab-admin migrate trac
75 77  
76 78 - Finally, just import the Trac data (may take a few minutes):
77 79  
78 80 .. code-block:: sh
79 81  
80   - # Since you are in the folder colab
  82 + # Since you are in the folder colab
81 83 $ colab-admin import_proxy_data
82 84  
83 85 Settings
... ...