def multipartResponse(parts):
    # call with ( (filename, contentType, content), ...)
    boundary='----multipart-boundary-%s----' % (uuid.uuid1(),)
    response.content_type = 'multipart/mixed; boundary=%s' % (boundary,)
    buf = []
    
    for filename, contentType, content in parts:
        buf.append("\r\n" + boundary + "\r\n")
        buf.append('Content-Disposition: attachment; filename="{0}";\r\n'.format(filename))
        buf.append('Content-Type: {0};\r\n'.format(contentType))
        buf.append('Content-Length: {0}\r\n'.format(len(content)))
        buf.append('\r\n')
        buf.append(content)
    buf.append("\r\n" + boundary + "\r\n")
    s = ''.join(buf)
    response.content_length = len(s)
    return s
dataset/ETHPy150Open Arelle/Arelle/arelle/CntlrWebMain.py/multipartResponse/original