Conjunto de mudanças 6216 no repositório publico


Ignorar:
Timestamp:
18/04/2012 17:19:24 (9 anos atrás)
Autor:
seocam
Mensagem:

Merge com https://bitbucket.org/seocam/atu-colab/src/e5452b943276

Localização:
colab/trunk
Arquivos:
7 editados

Legenda:

Não Modificado
Adicionado
Removido
  • colab/trunk/colab/solrutils.py

    r6215 r6216  
    7777    """
    7878   
    79     username = doc.get('Creator')
     79    username = doc.get('last_author')
     80    if not username:
     81        username = doc.get('Creator')
    8082    from_addresses = EmailAddress.objects.filter(user__username=username)
    8183    if username and from_addresses:
  • colab/trunk/colab/super_archives/management/commands/import_emails.py

    r6215 r6216  
    1212from django.db import transaction
    1313from django.template.defaultfilters import slugify
    14 from django.core.exceptions import ObjectDoesNotExist
    1514from django.core.management.base import BaseCommand, CommandError
    1615
     
    155154        mailinglist.last_imported_index = index
    156155       
    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:
    164166            self.create_email(mailinglist, email_msg)
    165167       
  • colab/trunk/colab/super_archives/queries.py

    r6215 r6216  
    11
     2from django.core.exceptions import ObjectDoesNotExist
    23from colab.super_archives.models import Thread, Vote, Message, PageHit
    34
     
    3031    query = get_messages_by_date()
    3132    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
    3337    return query
    3438
  • colab/trunk/colab/super_archives/templates/message-preview.html

    r6017 r6216  
    66  <img alt="{{ doc.Type }}" title="{{ doc.Type }}"
    77       src="{{ STATIC_URL }}img/{{ doc.Type }}.png" />
     8  {% else %}
     9  <img alt="thread" title="thread"
     10       src="{{ STATIC_URL }}img/thread.png" />
    811  {% endif %}
    912 
     
    3033  <div class="quiet">
    3134    <span class="left">
    32       {% trans "criado por" %}
     35      {% trans "por" %}
    3336      {% if doc.from_address.get_full_name %}
    3437      <a href="{{ doc.from_address.get_profile_link }}">
     
    3639      </a>
    3740      {% else %}
    38         {% firstof doc.Creator _("anônimo") %}
     41        {% firstof doc.last_author doc.Creator _("anônimo") %}
    3942      {% endif %}
    4043    </span>   
  • colab/trunk/colab/super_archives/views.py

    r6215 r6216  
    11# -*- coding: utf-8 -*-
    22
     3from django.http import Http404
    34from django.template import RequestContext
    45from django.core.paginator import Paginator
     6from django.core.exceptions import ObjectDoesNotExist
    57from django.shortcuts import render_to_response, get_list_or_404
    68
     
    1113def thread(request, mailinglist, thread_token):
    1214
    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
    1419    order_by = request.GET.get('order')
    1520    if order_by == 'voted':
  • colab/trunk/solr-conf/data-config.xml

    r6126 r6216  
    1818            query="SELECT
    1919                     name,
    20                      TIMESTAMP 'epoch' + (max(time)/1000000) * INTERVAL '1s' AS modified,
     20                     TIMESTAMP WITH TIME ZONE 'epoch' + (max(time)/1000000) * INTERVAL '1s' AS modified,
    2121                     max(version) AS version
    2222                   FROM wiki GROUP BY name"
     
    2828              WHERE
    2929                time > (EXTRACT(
    30                   epoch FROM TIMESTAMP '${dataimporter.wiki.last_index_time}'
     30                  epoch FROM TIMESTAMP WITH TIME ZONE '${dataimporter.wiki.last_index_time}'
    3131                ) * 1000000)"
    3232            deltaImportQuery="
    3333                   SELECT
    3434                     name,
    35                      TIMESTAMP 'epoch' + (max(time)/1000000) * INTERVAL '1s' AS modified,
    3635                     max(version) AS version
    3736                   FROM
     
    4544              query="SELECT
    4645                       author AS Creator,
    47                        TIMESTAMP 'epoch' + (time/1000000) * INTERVAL '1s' AS created
     46                       TIMESTAMP WITH TIME ZONE 'epoch' + (time/1000000) * INTERVAL '1s' AS created
    4847                     FROM
    4948                       wiki
     
    5150                       name = '${wiki.name}'
    5251                       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}'" />
    5363     
    5464      <entity name="wiki_collaborators"
     
    94104              WHERE
    95105                time > (EXTRACT(
    96                   epoch FROM TIMESTAMP '${dataimporter.ticket.last_index_time}'
     106                  epoch FROM TIMESTAMP WITH TIME ZONE '${dataimporter.ticket.last_index_time}'
    97107                ) * 1000000)"
    98108            query="SELECT
     
    108118                     owner,
    109119                     status,
    110                      TIMESTAMP 'epoch' + (time/1000000)* INTERVAL '1s' AS created,
    111                      TIMESTAMP 'epoch' + (changetime/1000000) * INTERVAL '1s' AS modified
     120                     TIMESTAMP WITH TIME ZONE 'epoch' + (time/1000000)* INTERVAL '1s' AS created,
     121                     TIMESTAMP WITH TIME ZONE 'epoch' + (changetime/1000000) * INTERVAL '1s' AS modified
    112122                   FROM
    113123                     ticket">
     
    150160                       keywords != ''" />
    151161     
     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
    152174      <entity name="ticket_comments"
    153175              dataSource="trac"
     
    184206            WHERE
    185207              time > (EXTRACT(
    186                 epoch FROM TIMESTAMP '${dataimporter.changeset.last_index_time}'
     208                epoch FROM TIMESTAMP WITH TIME ZONE '${dataimporter.changeset.last_index_time}'
    187209              ) * 1000000)"
    188210
     
    192214                     author AS collaborator,
    193215                     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,
    196218                     message                   
    197219                   FROM
     
    275297              transformer="TemplateTransformer"
    276298              query="SELECT DISTINCT ON (sam.thread_id)
    277                        sam.body AS Description,
    278299                       sam.received_time AS created,
    279300                       sam.subject_clean AS subject,
     
    300321              dataSource="colab"
    301322              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}" />
    307334
    308335      <entity name="thread_collaborators"
  • colab/trunk/solr-conf/schema.xml

    r6208 r6216  
    471471   <field name="Creator" type="string" indexed="true"
    472472          stored="true" required="false" multiValued="false"/>
     473   <field name="last_author" type="string" indexed="true"
     474          stored="true" required="false" multiValued="false"/>
    473475   <field name="created" type="date" indexed="true"
    474476          stored="true" required="false" multiValued="false"/>
Note: Veja TracChangeset para ajuda no uso do visualizador de conjunto de mudanças.
 

The contents and data of this website are published under license:
Creative Commons 4.0 Brasil - Atribuir Fonte - Compartilhar Igual.