summaryrefslogtreecommitdiffstats
path: root/hyperkitty/lib
diff options
context:
space:
mode:
authorAurélien Bompard <aurelien@bompard.org>2013-01-09 15:19:30 +0100
committerAurélien Bompard <aurelien@bompard.org>2013-01-09 15:19:30 +0100
commite45d9e5ac7b3329cc028fa256daa15c485c8f09e (patch)
tree972f04e0dd7ba76c40a043363f2bd84d02ba7f89 /hyperkitty/lib
parent18dca8fc476ec8724adb15ecd7aa9fe02813b416 (diff)
downloadhyperkitty-e45d9e5ac7b3329cc028fa256daa15c485c8f09e.tar.gz
hyperkitty-e45d9e5ac7b3329cc028fa256daa15c485c8f09e.tar.xz
hyperkitty-e45d9e5ac7b3329cc028fa256daa15c485c8f09e.zip
Move the thread sorting code to kittystore
Diffstat (limited to 'hyperkitty/lib')
-rw-r--r--hyperkitty/lib/__init__.py21
1 files changed, 0 insertions, 21 deletions
diff --git a/hyperkitty/lib/__init__.py b/hyperkitty/lib/__init__.py
index 14bde15..52b6bdc 100644
--- a/hyperkitty/lib/__init__.py
+++ b/hyperkitty/lib/__init__.py
@@ -23,7 +23,6 @@ import urllib
from hashlib import md5
import datetime
-import networkx as nx
from django.conf import settings
@@ -87,23 +86,3 @@ def get_display_dates(year, month, day):
end_date = begin_date + datetime.timedelta(days=1)
return begin_date, end_date
-
-
-def sort_thread(thread):
- def walk_successors(msgid, level, result):
- obj = graph.node[msgid]["obj"]
- obj.level = level
- result.append(obj)
- level += 1
- for succ in sorted(graph.successors(msgid),
- key=lambda m: graph.node[m]["num"]):
- walk_successors(succ, level, result)
- level -= 1
- graph = nx.DiGraph()
- for index, email in enumerate(thread.emails):
- graph.add_node(email.message_id, num=index, obj=email)
- if email.in_reply_to is not None:
- graph.add_edge(email.in_reply_to, email.message_id)
- result = []
- walk_successors(thread.starting_email.message_id, 0, result)
- return result