[Spambayes-checkins] spambayes SmarterHTTPServer.py,1.1,1.2 pop3proxy.py,1.33,1.34

Skip Montanaro montanaro at users.sourceforge.net
Wed Jan 15 14:45:13 EST 2003


Update of /cvsroot/spambayes/spambayes
In directory sc8-pr-cvs1:/tmp/cvs-serv28377

Modified Files:
	SmarterHTTPServer.py pop3proxy.py 
Log Message:
Unify StringIO imports to always try cStringIO and fallback to StringIO


Index: SmarterHTTPServer.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/SmarterHTTPServer.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SmarterHTTPServer.py	1 Dec 2002 04:11:39 -0000	1.1
--- SmarterHTTPServer.py	15 Jan 2003 22:45:11 -0000	1.2
***************
*** 24,28 ****
  import mimetypes
  import re
! from StringIO import StringIO
  
  
--- 24,31 ----
  import mimetypes
  import re
! try:
!     import cStringIO as StringIO
! except ImportError:
!     import StringIO
  
  
***************
*** 96,100 ****
                  self.send_response(200)
                  retstr = getattr(self, methname)(pdict)
!                 f = StringIO(retstr)
                  self.send_header("Content-type", 'text/html')
                  self.end_headers()
--- 99,103 ----
                  self.send_response(200)
                  retstr = getattr(self, methname)(pdict)
!                 f = StringIO.StringIO(retstr)
                  self.send_header("Content-type", 'text/html')
                  self.end_headers()

Index: pop3proxy.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/pop3proxy.py,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** pop3proxy.py	14 Jan 2003 05:38:19 -0000	1.33
--- pop3proxy.py	15 Jan 2003 22:45:11 -0000	1.34
***************
*** 139,143 ****
  """
  
! import os, sys, re, operator, errno, getopt, string, cStringIO, time, bisect
  import socket, asyncore, asynchat, cgi, urlparse, webbrowser
  import mailbox, email.Header
--- 139,148 ----
  """
  
! try:
!     import cStringIO as StringIO
! except ImportError:
!     import StringIO
! 
! import os, sys, re, operator, errno, getopt, string, time, bisect
  import socket, asyncore, asynchat, cgi, urlparse, webbrowser
  import mailbox, email.Header
***************
*** 794,798 ****
                  if contentType == 'multipart/form-data':
                      # multipart/form-data - probably a file upload.
!                     bodyFile = cStringIO.StringIO(body)
                      params.update(cgi.parse_multipart(bodyFile, pdict))
                  else:
--- 799,803 ----
                  if contentType == 'multipart/form-data':
                      # multipart/form-data - probably a file upload.
!                     bodyFile = StringIO.StringIO(body)
                      params.update(cgi.parse_multipart(bodyFile, pdict))
                  else:
***************
*** 934,938 ****
                  def __init__(self, fp):
                      self.guts = fp.read()
!             contentFile = cStringIO.StringIO(content)
              mbox = mailbox.PortableUnixMailbox(contentFile, SimpleMessage)
              messages = map(lambda m: m.guts, mbox)
--- 939,943 ----
                  def __init__(self, fp):
                      self.guts = fp.read()
!             contentFile = StringIO.StringIO(content)
              mbox = mailbox.PortableUnixMailbox(contentFile, SimpleMessage)
              messages = map(lambda m: m.guts, mbox)





More information about the Spambayes-checkins mailing list