summaryrefslogtreecommitdiffstats
path: root/hyperkitty/views/list.py
diff options
context:
space:
mode:
authorAamir Khan <syst3m.w0rm@gmail.com>2012-08-10 06:21:15 +0530
committerAamir Khan <syst3m.w0rm@gmail.com>2012-08-10 06:21:15 +0530
commite5dc1c48ea48177e21cff6670a2dbf0c4c4cf262 (patch)
tree8dd57320e742394034515158c013915595877c1a /hyperkitty/views/list.py
parent6da4589cf562033fba6e1f5d910a28dbe39dc313 (diff)
downloadhyperkitty-e5dc1c48ea48177e21cff6670a2dbf0c4c4cf262.tar.gz
hyperkitty-e5dc1c48ea48177e21cff6670a2dbf0c4c4cf262.tar.xz
hyperkitty-e5dc1c48ea48177e21cff6670a2dbf0c4c4cf262.zip
Feature : Add tag to email threads
Diffstat (limited to 'hyperkitty/views/list.py')
-rw-r--r--hyperkitty/views/list.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/hyperkitty/views/list.py b/hyperkitty/views/list.py
index df745a2..843cd97 100644
--- a/hyperkitty/views/list.py
+++ b/hyperkitty/views/list.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
import re
import os
import json
@@ -17,7 +18,7 @@ from django.contrib.auth.decorators import (login_required,
user_passes_test)
from kittystore.kittysastore import KittySAStore
-from hyperkitty.models import Rating
+from hyperkitty.models import Rating, Tag
from hyperkitty.lib.mockup import *
from forms import *
from hyperkitty.utils import log
@@ -64,7 +65,7 @@ def archives(request, mlist_fqdn, year=None, month=None, day=None):
if not end_date:
today = datetime.utcnow()
begin_date = datetime(today.year, today.month, 1)
- end_date = datetime(today.year, today.month+1, 1)
+ end_date = datetime(today.year, today.month + 1, 1)
month_string = 'Past thirty days'
list_name = mlist_fqdn.split('@')[0]
@@ -125,7 +126,7 @@ def list(request, mlist_fqdn=None):
end_date = datetime(today.year, today.month, today.day)
begin_date = end_date - timedelta(days=32)
- threads = STORE.get_archives(list_name=list_name,start=begin_date,
+ threads = STORE.get_archives(list_name=list_name, start=begin_date,
end=end_date)
participants = set()
@@ -281,11 +282,19 @@ def search_keyword(request, mlist_fqdn, target, keyword, page=1):
def search_tag(request, mlist_fqdn, tag=None, page=1):
- '''Searches both tag and topic'''
- if tag:
- query_string = {'Category': tag.capitalize()}
- else:
- query_string = None
- return _search_results_page(request, mlist_fqdn, query_string,
+ '''Returns emails having a particular tag'''
+
+ list_name = mlist_fqdn.split('@')[0]
+
+ try:
+ thread_ids = Tag.objects.filter(tag=tag)
+ except Tag.DoesNotExist:
+ thread_ids = {}
+
+ for thread in thread_ids:
+ threads = STORE.get_thread(list_name, thread.threadid)
+
+
+ return _search_results_page(request, mlist_fqdn, threads,
'Tag search', page, limit=50)