From 453ea7d24cff3fa1f4e96c4b1db18a1f44b815bc Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Mon, 15 Oct 2001 22:44:08 +0000 Subject: De-string-module-ification. Also, remove pickle import since it doesn't seem to be used anywhere. --- Mailman/Archiver/HyperArch.py | 78 ++++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/Mailman/Archiver/HyperArch.py b/Mailman/Archiver/HyperArch.py index abe407344..ed4183d46 100644 --- a/Mailman/Archiver/HyperArch.py +++ b/Mailman/Archiver/HyperArch.py @@ -35,9 +35,7 @@ import sys import re import cgi import urllib -import string import time -import pickle import os import posixfile import HyperDatabase @@ -55,6 +53,10 @@ if mm_cfg.GZIP_ARCHIVE_TXT_FILES: except ImportError: pass +EMPTYSTRING = '' +NL = '\n' + + def html_quote(s): repls = ( ('&', '&'), @@ -62,14 +64,14 @@ def html_quote(s): (">", '>'), ('"', '"')) for thing, repl in repls: - s = string.replace(s, thing, repl) + s = s.replace(thing, repl) return s def url_quote(s): return urllib.quote(s) def null_to_space(s): - return string.replace(s, '\000', ' ') + return s.replace('\000', ' ') def sizeof(filename): size = os.path.getsize(filename) @@ -86,7 +88,7 @@ html_charset = '': + if line.strip() == '': begin = 1 continue - if string.strip(line) == '': + if line.strip() == '': break self.body.append(line) @@ -554,7 +556,7 @@ class HyperArchive(pipermail.T): "listinfo": self.maillist.GetScriptURL('listinfo', absolute=1), "version": self.version} for t in ("thread", "subject", "author", "date"): - cap = string.upper(t[0]) + t[1:] + cap = t[0].upper() + t[1:] if self.type == cap: d["%s_ref" % (t)] = "" else: @@ -573,7 +575,7 @@ class HyperArchive(pipermail.T): "size": self.size, } for t in ("thread", "subject", "author", "date"): - cap = string.upper(t[0]) + t[1:] + cap = t[0].upper() + t[1:] if self.type == cap: d["%s_ref" % (t)] = "" else: @@ -606,7 +608,7 @@ class HyperArchive(pipermail.T): accum = [] for a in self.archives: accum.append(self.html_TOC_entry(a)) - d["archive_listing"] = string.join(accum, '') + d["archive_listing"] = EMPTYSTRING.join(accum) if not d.has_key("encoding"): d["encoding"] = "" return self.html_TOC_tmpl % d @@ -721,7 +723,7 @@ Archive working file %s present. Check %s for possibly unarchived msgs', """Return a list of indexes where the article should be filed. A string can be returned if the list only contains one entry, and the empty list is legal.""" - res = self.dateToVolName(string.atof(article.date)) + res = self.dateToVolName(float(article.date)) self.message("figuring article archives\n") self.message(res + "\n") return res @@ -756,8 +758,8 @@ Archive working file %s present. Check %s for possibly unarchived msgs', def volNameToDate(self,volname): - volname=string.strip(volname) - volre= { 'year' : r'^(?P[0-9]{4,4})$', + volname = volname.strip() + volre = {'year' : r'^(?P[0-9]{4,4})$', 'quarter' : r'^(?P[0-9]{4,4})q(?P[1234])$', 'month' : r'^(?P[0-9]{4,4})-(?P[a-zA-Z]+)$', 'week': r'^Week-of-Mon-(?P[0-9]{4,4})(?P[01][0-9])(?P[0123][0-9])', @@ -765,25 +767,25 @@ Archive working file %s present. Check %s for possibly unarchived msgs', for each in volre.keys(): match=re.match(volre[each],volname) if match: - year=string.atoi(match.group('year')) + year=int(match.group('year')) month=1 day = 1 if each == 'quarter': - q=string.atoi(match.group('quarter')) + q=int(match.group('quarter')) month=(q*3)-2 elif each == 'month': - monthstr=string.lower(match.group('month')) + monthstr=match.group('month').lower() m=[] for i in range(1,13): - m.append(string.lower( - time.strftime("%B",(1999,i,1,0,0,0,0,1,0)))) + m.append( + time.strftime("%B",(1999,i,1,0,0,0,0,1,0)).lower()) try: month=m.index(monthstr)+1 except ValueError: pass elif each == 'week' or each == 'day': - month = string.atoi(match.group("month")) - day = string.atoi(match.group("day")) + month = int(match.group("month")) + day = int(match.group("day")) return time.mktime((year,month,1,0,0,0,0,1,-1)) return 0.0 @@ -958,7 +960,7 @@ Archive working file %s present. Check %s for possibly unarchived msgs', d={} for each in self.__dict__.keys(): if not (each in self._skip_attrs - or string.upper(each) == each): + or each.upper() == each): d[each] = self.__dict__[each] return d -- cgit v1.3.1