summaryrefslogtreecommitdiffstats
path: root/Tools/scripts
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1995-10-30 10:23:10 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1995-10-30 10:23:10 (GMT)
commit81299f10f780655085bbceb9182d69f74802c7cf (patch)
tree0a606d63186fd96a1d728351d110a76c1fc11e21 /Tools/scripts
parent4ec940ad047f6b75f533e87f0ea9f8b7c31a0be0 (diff)
downloadcpython-81299f10f780655085bbceb9182d69f74802c7cf.zip
cpython-81299f10f780655085bbceb9182d69f74802c7cf.tar.gz
cpython-81299f10f780655085bbceb9182d69f74802c7cf.tar.bz2
Added providence mailer support
Diffstat (limited to 'Tools/scripts')
-rwxr-xr-xTools/scripts/mailerdaemon.py34
1 files changed, 33 insertions, 1 deletions
diff --git a/Tools/scripts/mailerdaemon.py b/Tools/scripts/mailerdaemon.py
index 1240ff4..075df1f 100755
--- a/Tools/scripts/mailerdaemon.py
+++ b/Tools/scripts/mailerdaemon.py
@@ -156,9 +156,41 @@ def emparse_compuserve(fp):
errors.append(line)
return errors
+prov_pattern = regex.compile('.* | \(.*\)')
+def emparse_providence(fp):
+ while 1:
+ line = fp.readline()
+ if not line:
+ raise Unparseable
+ line = line[:-1]
+
+ # Check that we're not in the returned message yet
+ if string.lower(line)[:5] == 'from:':
+ raise Unparseable
+ exp = 'The following errors occurred'
+ if line[:len(exp)] == exp:
+ break
+
+ errors = []
+ while 1:
+ line = fp.readline()
+ if not line:
+ break
+ line = line[:-1]
+ if not line:
+ continue
+ if line[:4] == '----':
+ break
+ if prov_pattern.match(line) > 0:
+ errors.append(prov_pattern.group(1))
+
+ if not errors:
+ raise Unparseable
+ return errors
-EMPARSERS = [emparse_sendmail, emparse_aol, emparse_cts, emparse_compuserve]
+EMPARSERS = [emparse_sendmail, emparse_aol, emparse_cts, emparse_compuserve,
+ emparse_providence]
def parsedir(dir, modify):
os.chdir(dir)