Since upgrading from Zope 2.8.something to 2.9.3, many of our customers
can no longer view PDFs that we send them.  If they're using Internet
Explorer, they often get a blank page when trying to view them (and we
haven't been able to nail down the exact combination of Windows + IE +
Acrobat that causes the problem).

Here's the Python script we use to send the files:

    ## Script (Python) "download"
    ##bind container=container
    ##bind context=context
    ##bind namespace=
    ##bind script=script
    ##bind subpath=traverse_subpath
    request = container.REQUEST
    RESPONSE =  request.RESPONSE

    stockexception = 'FileUnavailableError'

    # Does the file exist?
    if not filename in context.files.objectIds():
        raise stockexception

    file = context.files[filename]

    # Does the given password match the one on the file?
    if file.getProperty('password', d=None) != password:
        raise stockexception

    if not skipctypeheader:
        # Set the content type if one is defined for the file
        ctype = file.getProperty('content_type', d=None)
        if ctype:
            RESPONSE.setHeader('Content-Type', ctype)

    RESPONSE.setHeader('Content-Disposition', 'inline; filename=%s' % filename)

    return context.files[filename]

Here's the output of running 'curl' to fetch one:

    $ curl -vv 
'' > 
    * About to connect() to port 80
    *   Trying connected
    * Connected to ( port 80
    > GET /publicstore/download?filename=print.pdf&password=foo HTTP/1.1
    > User-Agent: curl/7.15.1 (i486-pc-linux-gnu) libcurl/7.15.1 OpenSSL/0.9.8a 
zlib/1.2.3 libidn/0.5.18
    > Host:
    > Accept: */*
    < HTTP/1.1 200 OK
    < Date: Thu, 17 Aug 2006 14:34:12 GMT
    < Server: Zope/(Zope 2.9.3-, python 2.4.3, freebsd6) ZServer/1.1
    < Content-Length: 1742
    < Content-Type: application/pdf; charset=iso-8859-15
    < Content-Disposition: inline; filename=print.pdf
    < Vary: User-Agent
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  
                                     Dload  Upload   Total   Spent    Left  
    100  1742  100  1742    0     0  20835      0 --:--:-- --:--:-- --:--:--  
541k* Connection #0 to host left intact
    * Closing connection #0

I feel kind of sheepish about blaming Zope, but everything worked perfectly
one day, I did the upgrade that night, and the complaints started rolling
in the next morning.

If nothing else, would some IE users be kind enough to try to view this
tiny PDF and see whether it opens inline or externally, and whether it
displays actual content (the phrase "This is a test.") or a blank page:

Many thanks in advance.  My boss is increasingly unamused and I'm out of
Kirk Strauser
The Day Companies
Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to