diff options
| author | bwarsaw | 2003-01-19 23:32:37 +0000 |
|---|---|---|
| committer | bwarsaw | 2003-01-19 23:32:37 +0000 |
| commit | e812a12882cc6b98fc20714d0e98c4333344fe2b (patch) | |
| tree | 5822e837adc01bce20d8d30b9dc59e3151db59fb | |
| parent | 9961b5bc3258d492d783987345b1ac7f2aa895a2 (diff) | |
| download | mailman-e812a12882cc6b98fc20714d0e98c4333344fe2b.tar.gz mailman-e812a12882cc6b98fc20714d0e98c4333344fe2b.tar.zst mailman-e812a12882cc6b98fc20714d0e98c4333344fe2b.zip | |
| -rw-r--r-- | Mailman/Archiver/HyperArch.py | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/Mailman/Archiver/HyperArch.py b/Mailman/Archiver/HyperArch.py index 4633228d2..ea09b8778 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<bl: + elif al < bl: return -1 else: return 0 |
