Sha256: 55be6cf390e06d8427b560c9fc835791b4437b7c3cb64af569ff4171861664b5

Contents?: true

Size: 1.48 KB

Versions: 30

Compression:

Stored size: 1.48 KB

Contents

import mimetools
import multifile
import cStringIO

msg = """Mime-Version: 1.0
Content-Type: multipart/mixed;
        boundary="=====================_590453667==_"
X-OriginalArrivalTime: 05 Feb 2002 03:43:23.0310 (UTC) FILETIME=[42D88CE0:01C1ADF7]

--=====================_590453667==_
Content-Type: multipart/alternative;
        boundary="=====================_590453677==_.ALT"

--=====================_590453677==_.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed

test A
--=====================_590453677==_.ALT
Content-Type: text/html; charset="us-ascii"

<html>
<b>test B</font></b></html>

--=====================_590453677==_.ALT--

--=====================_590453667==_
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: attachment; filename="att.txt"

Attached Content.
Attached Content.
Attached Content.
Attached Content.

--=====================_590453667==_--

"""

boundaries = 0
linecount = 0

def getMIMEMsg(mf):
    global boundaries, linecount
    msg = mimetools.Message(mf)

    #print "TYPE: %s" % msg.gettype()
    if msg.getmaintype() == 'multipart':
        boundary = msg.getparam("boundary")
        boundaries += 1

        mf.push(boundary)
        while mf.next():
            getMIMEMsg(mf)
        mf.pop()
    else:
        lines = mf.readlines()
        linecount += len(lines)

def main():
    f = cStringIO.StringIO(msg)
    getMIMEMsg(multifile.MultiFile(f))
    assert boundaries == 2
    assert linecount == 9

if __name__ == '__main__':
    main()

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
rubyfox-server-2.19.2.0 lib/rubyfox/server/data/lib/Lib/test/test_multifile.py
rubyfox-server-2.17.3.2 lib/rubyfox/server/data/lib/Lib/test/test_multifile.py
rubyfox-server-2.17.3.1 lib/rubyfox/server/data/lib/Lib/test/test_multifile.py
rubyfox-server-2.17.3.0 lib/rubyfox/server/data/lib/Lib/test/test_multifile.py
rubyfox-server-2.16.3.2 lib/rubyfox/server/data/lib/Lib/test/test_multifile.py
rubyfox-server-2.16.3.1 lib/rubyfox/server/data/lib/Lib/test/test_multifile.py
rubyfox-server-2.16.0.4 lib/rubyfox/server/data/lib/Lib/test/test_multifile.py
rubyfox-server-2.16.0.3 lib/rubyfox/server/data/lib/Lib/test/test_multifile.py
rubyfox-server-2.16.0.2 lib/rubyfox/server/data/lib/Lib/test/test_multifile.py
rubyfox-server-2.16.0.1 lib/rubyfox/server/data/lib/Lib/test/test_multifile.py
rubyfox-server-2.16.0.0 lib/rubyfox/server/data/lib/Lib/test/test_multifile.py
rubyfox-server-2.13.7.3 lib/rubyfox/server/data/lib/Lib/test/test_multifile.py
rubyfox-server-2.13.6.2 lib/rubyfox/server/data/lib/Lib/test/test_multifile.py
rubyfox-server-2.13.6.1 lib/rubyfox/server/data/lib/Lib/test/test_multifile.py
rubyfox-server-2.13.5.1 lib/rubyfox/server/data/lib/Lib/test/test_multifile.py
rubyfox-server-2.13.4.1 lib/rubyfox/server/data/lib/Lib/test/test_multifile.py
rubyfox-server-2.13.3.1 lib/rubyfox/server/data/lib/Lib/test/test_multifile.py
rubyfox-server-2.12.5.1 lib/rubyfox/server/data/lib/Lib/test/test_multifile.py
rubyfox-server-2.12.5.0 lib/rubyfox/server/data/lib/Lib/test/test_multifile.py
rubyfox-server-2.12.4.0 lib/rubyfox/server/data/lib/Lib/test/test_multifile.py