aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Archiver/HyperArch.py
diff options
context:
space:
mode:
authorbwarsaw <>2003-02-08 07:14:13 +0000
committerbwarsaw <>2003-02-08 07:14:13 +0000
commit925200da11d52ae4d7fc664bff898f8050bef687 (patch)
tree389bbd6c076718221b427d6d6e4fa199a1729ec0 /Mailman/Archiver/HyperArch.py
parentdea51d7d5a5c5d8ea6900a838a12e230b7a000b6 (diff)
downloadmailman2-925200da11d52ae4d7fc664bff898f8050bef687.tar.gz
mailman2-925200da11d52ae4d7fc664bff898f8050bef687.tar.xz
mailman2-925200da11d52ae4d7fc664bff898f8050bef687.zip
Backporting from the trunk.
Diffstat (limited to 'Mailman/Archiver/HyperArch.py')
-rw-r--r--Mailman/Archiver/HyperArch.py33
1 files changed, 18 insertions, 15 deletions
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<bl:
+ elif al < bl:
return -1
else:
return 0