Great, response.stream did it!

The exact code I end up using (in case someone else needs to get
around the 'no_table.XXX' file name scenario). Another reason I like
this approach (vs 
http://mysite.com/my_app/my_cont/download/uploads/no_table.document.9b6546236b10.623456345667.png)
is the nonsensical file name on disk is never shown:

def document_download():
    import os, base64, contenttype
    stored_filename = get_filename_from_db()   #returns something like
no_table.document.9b6546236b10.623456345667.png
    filename = base64.b16decode(stored_filename.split('.')[3].upper())
    response.headers['Content-Type'] =
contenttype.contenttype(filename)
    response.headers['Content-Disposition'] = "attachment; filename=
%s" % filename
    response.stream(os.path.join(request.folder, 'uploads',
stored_filename), request=request)

Thanks again, Anthony...

Reply via email to