Fix StringIO

This commit is contained in:
Stuart D. Gathman
2016-07-26 10:06:56 -04:00
parent 999a446484
commit ea84943f29
6 changed files with 28 additions and 14 deletions
+6 -3
View File
@@ -3,7 +3,10 @@
from __future__ import print_function
import rfc822
import StringIO
try:
from StringIO import StringIO
except:
from io import StringIO
import Milter
Milter.NOREPLY = Milter.CONTINUE
@@ -152,14 +155,14 @@ class TestBase(object):
rc = self.body(buf)
if rc != Milter.CONTINUE: return rc
self._msg = msg
self._body = StringIO.StringIO()
self._body = StringIO()
rc = self.eom()
if self._bodyreplaced:
body = self._body.getvalue()
else:
msg.rewindbody()
body = msg.fp.read()
self._body = StringIO.StringIO()
self._body = StringIO()
self._body.writelines(msg.headers)
self._body.write('\n')
self._body.write(body)