summaryrefslogtreecommitdiffstats
path: root/hyperkitty/views/list.py
diff options
context:
space:
mode:
Diffstat (limited to 'hyperkitty/views/list.py')
-rw-r--r--hyperkitty/views/list.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/hyperkitty/views/list.py b/hyperkitty/views/list.py
index 3880f02..a61f0a9 100644
--- a/hyperkitty/views/list.py
+++ b/hyperkitty/views/list.py
@@ -208,11 +208,13 @@ def overview(request, mlist_fqdn=None):
reverse=True)
# Threads by category
- threads_by_category = defaultdict(list)
+ threads_by_category = {}
for thread in active_threads:
if not thread.category:
continue
- if len(threads_by_category[thread.category]) >= 5:
+ # don't use defaultdict, use .setdefault():
+ # http://stackoverflow.com/questions/4764110/django-template-cant-loop-defaultdict
+ if len(threads_by_category.setdefault(thread.category, [])) >= 5:
continue
threads_by_category[thread.category].append(thread)