[Zope-CMF] RE: [Zope] PDF documents in CMF (1.0)
Kent Polk
kent@goathill.org
20 Jun 2001 17:45:14 GMT
On 20 Jun 2001 07:15:00 -0500, Tres Seaver wrote:
> Dieter Maurer wrote:
>
>> Loren Stafford writes:
>> > I haven't found the root problem, but I discovered that if the object name
>> > ends in .pdf everything works as desired. I traced the headers generated by
>> > CMF and the MIME type is set correctly, but the browser seems to want to see
>> > the .pdf extension. CMF gives the download the same name as the object id
>> > (not the original client-side file-name), so changing the object name to
>> > something.pdf seems to satisfy the browser.
>> I have seen this with IE.
>> Apparently, it does not trust the "Content-Type" but wants to
>> have a corresponding name suffix, too.
>
>
> CMF 1.0 had a 'download' method for File objects which tried
> to do the Right Thing (TM) by setting the 'Content-Disposition'
> header; unfortunately, the browsers didn't support it.
>
> That method is deprecated, and no longer surfaced, in CMF 1.1;
> instead, when the File object is published directly (the URL
> points to it, with no method appended), we initiate the download;
> the browsers all do the correct thing in that case.
This is why (I think Brian) wrote a class wrapper that returned a
bobo-callable object from __bobo_traverse__ when a file was requested
for the PDMS. It basically set the the content headers and then
called the wrapper:
class dbFileData:
"""Class to wrap file data, allowing bobo to publish it"""
def __init__(self, data):
self.data=data
def __str__(self):
return self.data
class dbDocument:
"""Class to wrap document records"""
def __bobo_traverse__(self, REQUEST, key):