diff options
author | Walter Dörwald <walter@livinglogic.de> | 2002-09-11 20:36:02 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2002-09-11 20:36:02 (GMT) |
commit | aaab30e00cc3e8d90c71b8657c284feeb4ac1413 (patch) | |
tree | d055e0bd374770014d9afdff1b961418b1828584 /Tools/scripts/mailerdaemon.py | |
parent | 6a0477b099560a452e37fe77c3850bf232487c16 (diff) | |
download | cpython-aaab30e00cc3e8d90c71b8657c284feeb4ac1413.zip cpython-aaab30e00cc3e8d90c71b8657c284feeb4ac1413.tar.gz cpython-aaab30e00cc3e8d90c71b8657c284feeb4ac1413.tar.bz2 |
Apply diff2.txt from SF patch http://www.python.org/sf/572113
(with one small bugfix in bgen/bgen/scantools.py)
This replaces string module functions with string methods
for the stuff in the Tools directory. Several uses of
string.letters etc. are still remaining.
Diffstat (limited to 'Tools/scripts/mailerdaemon.py')
-rwxr-xr-x | Tools/scripts/mailerdaemon.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/Tools/scripts/mailerdaemon.py b/Tools/scripts/mailerdaemon.py index 113b376..85f90aa 100755 --- a/Tools/scripts/mailerdaemon.py +++ b/Tools/scripts/mailerdaemon.py @@ -1,6 +1,5 @@ """mailerdaemon - classes to parse mailer-daemon messages""" -import string import rfc822 import calendar import re @@ -18,9 +17,9 @@ class ErrorMessage(rfc822.Message): sub = self.getheader('Subject') if not sub: return 0 - sub = string.lower(sub) - if sub[:12] == 'waiting mail': return 1 - if string.find(sub, 'warning') >= 0: return 1 + sub = sub.lower() + if sub.startswith('waiting mail'): return 1 + if 'warning' in sub: return 1 self.sub = sub return 0 @@ -132,10 +131,10 @@ def emparse_list(fp, sub): if type(regexp) is type(''): for i in range(len(emails)-1,-1,-1): email = emails[i] - exp = re.compile(string.join(string.split(regexp, '<>'), re.escape(email)), re.MULTILINE) + exp = re.compile(re.escape(email).join(regexp.split('<>')), re.MULTILINE) res = exp.search(data) if res is not None: - errors.append(string.join(string.split(string.strip(email)+': '+res.group('reason')))) + errors.append(' '.join((email.strip()+': '+res.group('reason')).split())) del emails[i] continue res = regexp.search(data) @@ -143,14 +142,14 @@ def emparse_list(fp, sub): reason = res.group('reason') break for email in emails: - errors.append(string.join(string.split(string.strip(email)+': '+reason))) + errors.append(' '.join((email.strip()+': '+reason).split())) return errors EMPARSERS = [emparse_list, ] def sort_numeric(a, b): - a = string.atoi(a) - b = string.atoi(b) + a = int(a) + b = int(b) if a < b: return -1 elif a > b: return 1 else: return 0 |