This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author elachuni
Recipients anglocelt, elachuni, mcicogni, taukki, vila
Date 2008-09-12.01:18:03
SpamBayes Score 0.00022352114
Marked as misclassified No
Message-id <1221182286.15.0.289191996898.issue1441530@psf.upfronthosting.co.za>
In-reply-to
Content
It's probably just a typo from copying from an editor, but there is a
bug in the workaround.  It should be:

maxRead = 1000000
class MySSL (imaplib.IMAP4_SSL):
  def read (self, n):
    #print "..Attempting to read %d bytes" % n
      if n <= maxRead:
        return imaplib.IMAP4_SSL.read (self, n)
      else:
        soFar = 0
        result = ""
        while soFar < n:
          thisFragmentSize = min(maxRead, n-soFar)
          #print "..Reading fragment size %s" % thisFragmentSize
          fragment =\
            imaplib.IMAP4_SSL.read (self, thisFragmentSize)
          result += fragment
          soFar += thisFragmentSize # only a few, so not a tragic o/head
        return result

(With one less level of indentation in the last line).
Apart from that, the fix works wonderfully.
History
Date User Action Args
2008-09-12 01:18:06elachunisetrecipients: + elachuni, mcicogni, taukki, vila, anglocelt
2008-09-12 01:18:06elachunisetmessageid: <1221182286.15.0.289191996898.issue1441530@psf.upfronthosting.co.za>
2008-09-12 01:18:04elachunilinkissue1441530 messages
2008-09-12 01:18:03elachunicreate