summaryrefslogtreecommitdiffstats
path: root/views/pages.py
diff options
context:
space:
mode:
Diffstat (limited to 'views/pages.py')
-rw-r--r--views/pages.py73
1 files changed, 1 insertions, 72 deletions
diff --git a/views/pages.py b/views/pages.py
index 1d217c8..fcab462 100644
--- a/views/pages.py
+++ b/views/pages.py
@@ -22,8 +22,7 @@ from django.contrib.auth.decorators import (login_required,
from kittystore.kittysastore import KittySAStore
from gsoc.models import Rating
-
-from thread import AddTagForm
+from lib.mockup import *
logger = logging.getLogger(__name__)
@@ -343,73 +342,3 @@ def search_tag(request, mlist_fqdn, tag=None, page=1):
return _search_results_page(request, mlist_fqdn, query_string,
'Tag search', page, limit=50)
-def thread (request, mlist_fqdn, threadid):
- ''' Displays all the email for a given thread identifier '''
- list_name = mlist_fqdn.split('@')[0]
-
- search_form = SearchForm(auto_id=False)
- t = loader.get_template('thread.html')
- threads = STORE.get_thread(list_name, threadid)
- #prev_thread = mongo.get_thread_name(list_name, int(threadid) - 1)
- prev_thread = []
- if len(prev_thread) > 30:
- prev_thread = '%s...' % prev_thread[:31]
- #next_thread = mongo.get_thread_name(list_name, int(threadid) + 1)
- next_thread = []
- if len(next_thread) > 30:
- next_thread = '%s...' % next_thread[:31]
-
- participants = {}
- cnt = 0
-
- for message in threads:
- # @TODO: Move this logic inside KittyStore?
- message.email = message.email.strip()
-
- # Extract all the votes for this message
- try:
- votes = Rating.objects.filter(messageid = message.message_id)
- except Rating.DoesNotExist:
- votes = {}
-
- likes = 0
- dislikes = 0
-
- for vote in votes:
- if vote.vote == 1:
- likes = likes + 1
- elif vote.vote == -1:
- dislikes = dislikes + 1
- else:
- pass
-
- message.votes = votes
- message.likes = likes
- message.dislikes = dislikes
-
- # Statistics on how many participants and threads this month
- participants[message.sender] = {'email': message.email}
- cnt = cnt + 1
-
- archives_length = STORE.get_archives_length(list_name)
- from_url = '/thread/%s/%s/' %(mlist_fqdn, threadid)
- tag_form = AddTagForm(initial={'from_url' : from_url})
- print dir(search_form)
-
- c = RequestContext(request, {
- 'list_name' : list_name,
- 'list_address': mlist_fqdn,
- 'search_form': search_form,
- 'addtag_form': tag_form,
- 'month': 'Thread',
- 'participants': participants,
- 'answers': cnt,
- 'first_mail': threads[0],
- 'threads': threads[1:],
- 'next_thread': next_thread,
- 'next_thread_id': 0,
- 'prev_thread': prev_thread,
- 'prev_thread_id': 0,
- 'archives_length': archives_length,
- })
- return HttpResponse(t.render(c))