[Mailman-Developers] [Bug] Digest volume increments daily

Les Niles les@2pi.org
Fri, 8 Mar 2002 08:24:04 -0800


In 2.1a4, and AFAICT the current cvs tree, the digest volume number
gets incremented daily regardless of the configured rate.  This is
because the test for the frequency of update is combined with the
test for whether to actually update, causing the default branch --
update daily -- to be executed most of the time.  Here's a patch
that fixes this.  

  -les

---------------------------------------------------------------------
*** Mailman/Handlers/ToDigest.py.orig   Sun Jan  6 23:04:03 2002
--- Mailman/Handlers/ToDigest.py        Thu Mar  7 06:27:09 2002
***************
*** 97,111 ****
          timetup = time.localtime(mlist.digest_last_sent_at)
          now = time.localtime(time.time())
          freq = mlist.digest_volume_frequency
!         if freq == 0 and timetup[0] < now[0]:
!             bump = 1                              # Yearly
!         elif freq == 1 and timetup[1] <> now[1]:
              # Monthly, but we take a cheap way to calculate this.  We assume
              # that the clock isn't going to be reset backwards.
!             bump = 1
!         elif freq == 2 and (timetup[1] % 4 <> now[1] % 4):
              # Quarterly, same caveat
!             bump = 1
          elif freq == 3:
              # Once again, take a cheap way of calculating this
              weeknum_last = int(time.strftime('%W', timetup))
--- 97,114 ----
          timetup = time.localtime(mlist.digest_last_sent_at)
          now = time.localtime(time.time())
          freq = mlist.digest_volume_frequency
!         if freq == 0:
!             if timetup[0] < now[0]:
!                 bump = 1                              # Yearly
!         elif freq == 1:
              # Monthly, but we take a cheap way to calculate this.  We assume
              # that the clock isn't going to be reset backwards.
!             if timetup[1] <> now[1]:
!                 bump = 1
!         elif freq == 2:
              # Quarterly, same caveat
!             if (timetup[1] % 4 <> now[1] % 4):
!                 bump = 1
          elif freq == 3:
              # Once again, take a cheap way of calculating this
              weeknum_last = int(time.strftime('%W', timetup))