aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/bugdir.py
diff options
context:
space:
mode:
authorAaron Bentley <abentley@panoramicfeedback.com>2006-04-03 13:42:14 -0400
committerAaron Bentley <abentley@panoramicfeedback.com>2006-04-03 13:42:14 -0400
commit57ad245e927b1e5a9b230de3605431a041bb192e (patch)
treec3b3628c6b1a5677891940dadae4ee58a07dc37a /libbe/bugdir.py
parent28da7287b32e070034b8c093938effeedb2eb54e (diff)
downloadbugseverywhere-57ad245e927b1e5a9b230de3605431a041bb192e.tar.gz
Added reply handling to comments
Diffstat (limited to 'libbe/bugdir.py')
-rw-r--r--libbe/bugdir.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/libbe/bugdir.py b/libbe/bugdir.py
index b78ec06..fafd1ac 100644
--- a/libbe/bugdir.py
+++ b/libbe/bugdir.py
@@ -370,7 +370,28 @@ class Comment(object):
if name is None:
return my_dir
return os.path.join(my_dir, name)
-
+
+
+def thread_comments(comments):
+ child_map = {}
+ top_comments = []
+ for comment in comments:
+ child_map[comment.uuid] = []
+ for comment in comments:
+ if comment.in_reply_to is None or comment.in_reply_to not in child_map:
+ top_comments.append(comment)
+ continue
+ child_map[comment.in_reply_to].append(comment)
+
+ def recurse_children(comment):
+ child_list = []
+ for child in child_map[comment.uuid]:
+ child_list.append(recurse_children(child))
+ return (comment, child_list)
+ print top_comments
+ return [recurse_children(c) for c in top_comments]
+
+
def pyname_to_header(name):
return name.capitalize().replace('_', '-')