From 925200da11d52ae4d7fc664bff898f8050bef687 Mon Sep 17 00:00:00 2001 From: bwarsaw <> Date: Sat, 8 Feb 2003 07:14:13 +0000 Subject: Backporting from the trunk. --- Mailman/Archiver/HyperArch.py | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'Mailman/Archiver/HyperArch.py') diff --git a/Mailman/Archiver/HyperArch.py b/Mailman/Archiver/HyperArch.py index 4633228d..ea09b877 100644 --- a/Mailman/Archiver/HyperArch.py +++ b/Mailman/Archiver/HyperArch.py @@ -888,40 +888,43 @@ class HyperArchive(pipermail.T): return time.strftime("%Y-%B",datetuple) - def volNameToDate(self,volname): + def volNameToDate(self, volname): volname = volname.strip() for each in self._volre.keys(): - match=re.match(self._volre[each],volname) + match = re.match(self._volre[each],volname) if match: - year=int(match.group('year')) - month=1 + year = int(match.group('year')) + month = 1 day = 1 if each == 'quarter': - q=int(match.group('quarter')) - month=(q*3)-2 + q = int(match.group('quarter')) + month = (q * 3) - 2 elif each == 'month': - monthstr=match.group('month').lower() - m=[] + monthstr = match.group('month').lower() + m = [] for i in range(1,13): m.append( time.strftime("%B",(1999,i,1,0,0,0,0,1,0)).lower()) try: - month=m.index(monthstr)+1 + month = m.index(monthstr) + 1 except ValueError: pass elif each == 'week' or each == 'day': month = int(match.group("month")) day = int(match.group("day")) - return time.mktime((year,month,1,0,0,0,0,1,-1)) + try: + return time.mktime((year,month,1,0,0,0,0,1,-1)) + except OverflowError: + return 0.0 return 0.0 def sortarchives(self): - def sf(a,b,s=self): - al=s.volNameToDate(a) - bl=s.volNameToDate(b) - if al>bl: + def sf(a, b): + al = self.volNameToDate(a) + bl = self.volNameToDate(b) + if al > bl: return 1 - elif al