@@ -95,7 +95,7 @@ class node. Any parts of other types are each stored in separate files
9595from __future__ import print_function
9696__docformat__ = 'restructuredtext'
9797
98- import string , re , os , mimetools , cStringIO , smtplib , socket , binascii , quopri
98+ import string , re , os , mimetools , smtplib , socket , binascii , quopri
9999import time , random , sys , logging
100100import codecs
101101import traceback
@@ -108,6 +108,7 @@ class node. Any parts of other types are each stored in separate files
108108from roundup .mailer import Mailer , MessageSendError
109109from roundup .i18n import _
110110from roundup .hyperdb import iter_roles
111+ from roundup .anypy .strings import StringIO
111112
112113try :
113114 import pyme , pyme .core , pyme .constants , pyme .constants .sigsum
@@ -223,7 +224,7 @@ def getpart(self):
223224 '''
224225 boundary = self .getparam ('boundary' )
225226 mid , end = '--' + boundary , '--' + boundary + '--'
226- s = cStringIO . StringIO ()
227+ s = StringIO ()
227228 while 1 :
228229 line = self .fp .readline ()
229230 if not line :
@@ -303,7 +304,7 @@ def getname(self):
303304 # the subject of the actual e-mail embedded here
304305 # we add a '.eml' extension like other email software does it
305306 self .fp .seek (0 )
306- s = cStringIO . StringIO (self .getbody ())
307+ s = StringIO (self .getbody ())
307308 name = Message (s ).getheader ('subject' )
308309 if name :
309310 name = name + '.eml'
@@ -329,7 +330,7 @@ def getbody(self):
329330 data = binascii .a2b_base64 (self .fp .read ())
330331 elif encoding == 'quoted-printable' :
331332 # the quopri module wants to work with files
332- decoded = cStringIO . StringIO ()
333+ decoded = StringIO ()
333334 quopri .decode (self .fp , decoded )
334335 data = decoded .getvalue ()
335336 elif encoding == 'uuencoded' :
@@ -449,7 +450,7 @@ def extract_content(self, parent_type=None, ignore_alternatives=False,
449450 attachments = []
450451 html_part = False
451452 elif unpack_rfc822 and content_type == 'message/rfc822' :
452- s = cStringIO . StringIO (self .getbody ())
453+ s = StringIO (self .getbody ())
453454 m = Message (s )
454455 ig = ignore_alternatives and not content
455456 new_content , attachments , html_part = m .extract_content (m .gettype (), ig ,
@@ -527,7 +528,7 @@ def decrypt(self, author, may_be_unsigned=False):
527528 # pyme.core.Data implements a seek method with a different signature
528529 # than roundup can handle. So we'll put the data in a container that
529530 # the Message class can work with.
530- c = cStringIO . StringIO ()
531+ c = StringIO ()
531532 c .write (plaintext .read ())
532533 c .seek (0 )
533534 return Message (c )
@@ -1328,7 +1329,7 @@ def do_pipe(self):
13281329
13291330 XXX: we may want to read this into a temporary file instead...
13301331 """
1331- s = cStringIO . StringIO ()
1332+ s = StringIO ()
13321333 s .write (sys .stdin .read ())
13331334 s .seek (0 )
13341335 self .main (s )
@@ -1424,7 +1425,7 @@ def do_imap(self, server, user='', password='', mailbox='', ssl=0,
14241425 server .store (str (i ), '+FLAGS' , r'(\Deleted)' )
14251426
14261427 # process the message
1427- s = cStringIO . StringIO (data [0 ][1 ])
1428+ s = StringIO (data [0 ][1 ])
14281429 s .seek (0 )
14291430 self .handle_Message (Message (s ))
14301431 server .close ()
@@ -1493,7 +1494,7 @@ def _do_pop(self, server, user, password, apop, ssl):
14931494 # [ array of message lines ],
14941495 # number of octets ]
14951496 lines = server .retr (i )[1 ]
1496- s = cStringIO . StringIO ('\n ' .join (lines ))
1497+ s = StringIO ('\n ' .join (lines ))
14971498 s .seek (0 )
14981499 self .handle_Message (Message (s ))
14991500 # delete the message
0 commit comments