Some users can't view sent PDFs anymore
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 ##parameters=filename,password=None,skipctypeheader=None ##title= ## 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 'http://web2.xrsnet.com/publicstore/download?filename=print.pdf&password=foo' > /dev/null * About to connect() to web2.xrsnet.com port 80 * Trying 10.45.14.64... connected * Connected to web2.xrsnet.com (10.45.14.64) 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: web2.xrsnet.com > 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 Current Dload Upload Total Spent Left Speed 100 1742 100 1742 0 0 20835 0 --:--:-- --:--:-- --:--:-- 541k* Connection #0 to host web2.xrsnet.com 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: http://web2.xrsnet.com/publicstore/download?filename=print.pdf&password=foo Many thanks in advance. My boss is increasingly unamused and I'm out of ideas. -- Kirk Strauser The Day Companies
At Thursday 17/8/2006 11:41, Kirk Strauser wrote:
stockexception = 'FileUnavailableError'
# Does the file exist? if not filename in context.files.objectIds(): raise stockexception
This is unrelated to your main question, but using string exceptions is discouraged... Gabriel Genellina Softlab SRL __________________________________________________ Pregunt�. Respond�. Descubr�. Todo lo que quer�as saber, y lo que ni imaginabas, est� en Yahoo! Respuestas (Beta). �Probalo ya! http://www.yahoo.com.ar/respuestas
On Thursday 17 August 2006 2:39 pm, Gabriel Genellina wrote:
This is unrelated to your main question, but using string exceptions is discouraged...
Yeah, I'm in the process of gradually upgrading from "look at me, I'm learning Python!" code to something a little more presentable. -- Kirk Strauser The Day Companies
participants (2)
-
Gabriel Genellina -
Kirk Strauser