summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhmeland2000-04-09 10:54:26 +0000
committerhmeland2000-04-09 10:54:26 +0000
commitb1c50a134bf8c748e452988bd5bb58cbcfc414a4 (patch)
treeec14cffa4c4ef85601b861ad342f8d7a01ba8ce8
parenta589de5a030298374fbf228de1224c73a41faf33 (diff)
downloadmailman-b1c50a134bf8c748e452988bd5bb58cbcfc414a4.tar.gz
mailman-b1c50a134bf8c748e452988bd5bb58cbcfc414a4.tar.zst
mailman-b1c50a134bf8c748e452988bd5bb58cbcfc414a4.zip
dateToVolName():
* Now uses time.localtime() instead of time.gmtime(). * The former strategy for generating names of weekly archives was dependent on time.strftime() doing the right thing if the day of the month was negative. At least Solaris strftime() did strange things (like having '%d' generate a string containing '/') when faced with this problem, so the strategy has now been changed. Besides, I have changed "self.maillist._internal_name" to "self.maillist.internal_name()" for purely religious reasons (non-related objects shouldn't access each other's "private" attributes).
-rw-r--r--Mailman/Archiver/HyperArch.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/Mailman/Archiver/HyperArch.py b/Mailman/Archiver/HyperArch.py
index 0cff20288..2e7f8a17d 100644
--- a/Mailman/Archiver/HyperArch.py
+++ b/Mailman/Archiver/HyperArch.py
@@ -486,7 +486,7 @@ class HyperArchive(pipermail.T):
# Check to see if the archive is gzip'd or not
txtfile = os.path.join(mm_cfg.PREFIX,
'archives/private',
- self.maillist._internal_name,
+ self.maillist.internal_name(),
a + '.txt')
gzfile = txtfile + '.gz'
templ = '<td><A href="%(url)s">[ %(fmt)sText%(sz)s]</a></td>'
@@ -567,7 +567,7 @@ class HyperArchive(pipermail.T):
try:
self._lock_file = posixfile.open(
os.path.join(mm_cfg.LOCK_DIR, '%s@arch.lock'
- % self.maillist._internal_name), 'a+')
+ % self.maillist.internal_name()), 'a+')
finally:
os.umask(ou)
# minor race condition here, there is no way to atomicly
@@ -643,7 +643,7 @@ class HyperArchive(pipermail.T):
# The following two methods should be inverses of each other. -ddm
def dateToVolName(self,date):
- datetuple=time.gmtime(date)
+ datetuple=time.localtime(date)
if self.ARCHIVE_PERIOD=='year':
return time.strftime("%Y",datetuple)
elif self.ARCHIVE_PERIOD=='quarter':
@@ -658,13 +658,12 @@ class HyperArchive(pipermail.T):
elif self.ARCHIVE_PERIOD == 'day':
return time.strftime("%Y%m%d", datetuple)
elif self.ARCHIVE_PERIOD == 'week':
- datetuple = list(datetuple)
- datetuple[2] = datetuple[2] - datetuple[6] # subtract week day
- #
- # even if the the day of the month counter is negative,
- # we still get the right thing from strftime! -scott
- #
- return time.strftime("Week-of-Mon-%Y%m%d", tuple(datetuple))
+ # Reconstruct "seconds since epoch", and subtract weekday
+ # multiplied by the number of seconds in a day.
+ monday = time.mktime(datetuple) - datetuple[6] * 24 * 60 * 60
+ # Build a new datetuple from this "seconds since epoch" value
+ datetuple = time.localtime(monday)
+ return time.strftime("Week-of-Mon-%Y%m%d", datetuple)
# month. -ddm
else:
return time.strftime("%Y-%B",datetuple)