Conjunto de mudanças 6216 no repositório publico
- Timestamp:
- 18/04/2012 17:19:24 (9 anos atrás)
- Localização:
- colab/trunk
- Arquivos:
-
- 7 editados
Legenda:
- Não Modificado
- Adicionado
- Removido
-
colab/trunk/colab/solrutils.py
r6215 r6216 77 77 """ 78 78 79 username = doc.get('Creator') 79 username = doc.get('last_author') 80 if not username: 81 username = doc.get('Creator') 80 82 from_addresses = EmailAddress.objects.filter(user__username=username) 81 83 if username and from_addresses: -
colab/trunk/colab/super_archives/management/commands/import_emails.py
r6215 r6216 12 12 from django.db import transaction 13 13 from django.template.defaultfilters import slugify 14 from django.core.exceptions import ObjectDoesNotExist15 14 from django.core.management.base import BaseCommand, CommandError 16 15 … … 155 154 mailinglist.last_imported_index = index 156 155 157 try: 158 # If the message is already at the database don't do anything 159 message = Message.objects.get( 160 message_id=email_msg.get('Message-ID')) 161 if message.thread.mailinglist.name != mailinglist.name: 162 raise ObjectDoesNotExist 163 except ObjectDoesNotExist: 156 # If the message is already at the database don't do anything 157 messages = Message.objects.filter( 158 message_id=email_msg.get('Message-ID')) 159 create = False 160 if not messages: 161 create = True 162 elif messages[0].thread.mailinglist.name != mailinglist.name: 163 create = True 164 165 if create: 164 166 self.create_email(mailinglist, email_msg) 165 167 -
colab/trunk/colab/super_archives/queries.py
r6215 r6216 1 1 2 from django.core.exceptions import ObjectDoesNotExist 2 3 from colab.super_archives.models import Thread, Vote, Message, PageHit 3 4 … … 30 31 query = get_messages_by_date() 31 32 query = query.filter(thread__mailinglist__name=mailinglist) 32 query = query.filter(thread__subject_token=thread_token)[0] 33 try: 34 query = query.filter(thread__subject_token=thread_token)[0] 35 except IndexError: 36 raise ObjectDoesNotExist 33 37 return query 34 38 -
colab/trunk/colab/super_archives/templates/message-preview.html
r6017 r6216 6 6 <img alt="{{ doc.Type }}" title="{{ doc.Type }}" 7 7 src="{{ STATIC_URL }}img/{{ doc.Type }}.png" /> 8 {% else %} 9 <img alt="thread" title="thread" 10 src="{{ STATIC_URL }}img/thread.png" /> 8 11 {% endif %} 9 12 … … 30 33 <div class="quiet"> 31 34 <span class="left"> 32 {% trans " criadopor" %}35 {% trans "por" %} 33 36 {% if doc.from_address.get_full_name %} 34 37 <a href="{{ doc.from_address.get_profile_link }}"> … … 36 39 </a> 37 40 {% else %} 38 {% firstof doc. Creator _("anônimo") %}41 {% firstof doc.last_author doc.Creator _("anônimo") %} 39 42 {% endif %} 40 43 </span> -
colab/trunk/colab/super_archives/views.py
r6215 r6216 1 1 # -*- coding: utf-8 -*- 2 2 3 from django.http import Http404 3 4 from django.template import RequestContext 4 5 from django.core.paginator import Paginator 6 from django.core.exceptions import ObjectDoesNotExist 5 7 from django.shortcuts import render_to_response, get_list_or_404 6 8 … … 11 13 def thread(request, mailinglist, thread_token): 12 14 13 first_message = queries.get_first_message_in_thread(mailinglist, thread_token) 15 try: 16 first_message = queries.get_first_message_in_thread(mailinglist, thread_token) 17 except ObjectDoesNotExist: 18 raise Http404 14 19 order_by = request.GET.get('order') 15 20 if order_by == 'voted': -
colab/trunk/solr-conf/data-config.xml
r6126 r6216 18 18 query="SELECT 19 19 name, 20 TIMESTAMP 'epoch' + (max(time)/1000000) * INTERVAL '1s' AS modified,20 TIMESTAMP WITH TIME ZONE 'epoch' + (max(time)/1000000) * INTERVAL '1s' AS modified, 21 21 max(version) AS version 22 22 FROM wiki GROUP BY name" … … 28 28 WHERE 29 29 time > (EXTRACT( 30 epoch FROM TIMESTAMP '${dataimporter.wiki.last_index_time}'30 epoch FROM TIMESTAMP WITH TIME ZONE '${dataimporter.wiki.last_index_time}' 31 31 ) * 1000000)" 32 32 deltaImportQuery=" 33 33 SELECT 34 34 name, 35 TIMESTAMP 'epoch' + (max(time)/1000000) * INTERVAL '1s' AS modified,36 35 max(version) AS version 37 36 FROM … … 45 44 query="SELECT 46 45 author AS Creator, 47 TIMESTAMP 'epoch' + (time/1000000) * INTERVAL '1s' AS created46 TIMESTAMP WITH TIME ZONE 'epoch' + (time/1000000) * INTERVAL '1s' AS created 48 47 FROM 49 48 wiki … … 51 50 name = '${wiki.name}' 52 51 AND version = 1" /> 52 53 <entity name="wiki_modification" 54 dataSource="trac" 55 query="SELECT 56 author AS last_author, 57 TIMESTAMP WITH TIME ZONE 'epoch' + (time/1000000) * INTERVAL '1s' AS modified 58 FROM 59 wiki 60 WHERE 61 name = '${wiki.name}' 62 AND version = '${wiki.version}'" /> 53 63 54 64 <entity name="wiki_collaborators" … … 94 104 WHERE 95 105 time > (EXTRACT( 96 epoch FROM TIMESTAMP '${dataimporter.ticket.last_index_time}'106 epoch FROM TIMESTAMP WITH TIME ZONE '${dataimporter.ticket.last_index_time}' 97 107 ) * 1000000)" 98 108 query="SELECT … … 108 118 owner, 109 119 status, 110 TIMESTAMP 'epoch' + (time/1000000)* INTERVAL '1s' AS created,111 TIMESTAMP 'epoch' + (changetime/1000000) * INTERVAL '1s' AS modified120 TIMESTAMP WITH TIME ZONE 'epoch' + (time/1000000)* INTERVAL '1s' AS created, 121 TIMESTAMP WITH TIME ZONE 'epoch' + (changetime/1000000) * INTERVAL '1s' AS modified 112 122 FROM 113 123 ticket"> … … 150 160 keywords != ''" /> 151 161 162 <entity name="ticket_modification" 163 dataSource="trac" 164 query="SELECT DISTINCT 165 author AS last_author 166 FROM 167 ticket_change 168 WHERE 169 ticket = ${ticket.id} AND 170 time = (SELECT max(time) 171 FROM ticket_change 172 WHERE ticket = ${ticket.id});" /> 173 152 174 <entity name="ticket_comments" 153 175 dataSource="trac" … … 184 206 WHERE 185 207 time > (EXTRACT( 186 epoch FROM TIMESTAMP '${dataimporter.changeset.last_index_time}'208 epoch FROM TIMESTAMP WITH TIME ZONE '${dataimporter.changeset.last_index_time}' 187 209 ) * 1000000)" 188 210 … … 192 214 author AS collaborator, 193 215 repos.value AS repos_name, 194 TIMESTAMP 'epoch' + (time/1000000) * INTERVAL '1s' AS created,195 TIMESTAMP 'epoch' + (time/1000000) * INTERVAL '1s' AS modified,216 TIMESTAMP WITH TIME ZONE 'epoch' + (time/1000000) * INTERVAL '1s' AS created, 217 TIMESTAMP WITH TIME ZONE 'epoch' + (time/1000000) * INTERVAL '1s' AS modified, 196 218 message 197 219 FROM … … 275 297 transformer="TemplateTransformer" 276 298 query="SELECT DISTINCT ON (sam.thread_id) 277 sam.body AS Description,278 299 sam.received_time AS created, 279 300 sam.subject_clean AS subject, … … 300 321 dataSource="colab" 301 322 query="SELECT 302 received_time AS modified 303 FROM 304 super_archives_message 305 WHERE 306 id = ${thread.latest_message_id}" /> 323 sam.body AS Description, 324 sam.received_time AS modified, 325 au.username AS last_author 326 FROM 327 super_archives_message AS sam 328 JOIN super_archives_emailaddress AS saea 329 ON sam.from_address_id = saea.id 330 LEFT JOIN auth_user AS au 331 ON au.id = saea.user_id 332 WHERE 333 sam.id = ${thread.latest_message_id}" /> 307 334 308 335 <entity name="thread_collaborators" -
colab/trunk/solr-conf/schema.xml
r6208 r6216 471 471 <field name="Creator" type="string" indexed="true" 472 472 stored="true" required="false" multiValued="false"/> 473 <field name="last_author" type="string" indexed="true" 474 stored="true" required="false" multiValued="false"/> 473 475 <field name="created" type="date" indexed="true" 474 476 stored="true" required="false" multiValued="false"/>
Note: Veja
TracChangeset
para ajuda no uso do visualizador de conjunto de mudanças.