Only compute allyearmonths if we actually need them master github/master
authorMagnus Hagander <magnus@hagander.net>
Tue, 3 Mar 2026 16:53:41 +0000 (17:53 +0100)
committerMagnus Hagander <magnus@hagander.net>
Tue, 3 Mar 2026 17:01:04 +0000 (18:01 +0100)
django/archives/mailarchives/views.py

index 3c5e68ac5a1007ed1b17c4ddc93dd85cc7f0acb6..b6ae5f0ed8f65c00014e75913762ad0926ea797e 100644 (file)
@@ -339,7 +339,6 @@ def _render_datelist(request, l, d, datefilter, title, queryproc):
         mlist = Message.objects.defer('bodytxt', 'cc', 'to').select_related().filter(datefilter, hiddenstatus__isnull=True).extra(where=["threadid IN (SELECT threadid FROM list_threads WHERE listid=%s)" % l.listid])
     mlist = queryproc(mlist)
 
-    allyearmonths = set([(m.date.year, m.date.month) for m in mlist])
     (yearmonth, daysinmonth) = get_monthday_info(mlist, l, d)
 
     # Calculate an ETag by hashing all the message id fields (int) and all the dates in the month that were active when rendered.
@@ -356,6 +355,7 @@ def _render_datelist(request, l, d, datefilter, title, queryproc):
     })
     r['ETag'] = etag
     if settings.PUBLIC_ARCHIVES:
+        allyearmonths = set([(m.date.year, m.date.month) for m in mlist])
         r['xkey'] = ' '.join(['pgam_{0}/{1}/{2}'.format(l.listid, year, month) for year, month in allyearmonths])
     return r