[Zope] Some users can't view sent PDFs anymore

2006-08-17 Thread Kirk Strauser
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.pdfpassword=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.pdfpassword=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   TimeTime Time  
Current
 Dload  Upload   Total   SpentLeft  
Speed
100  1742  100  17420 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.pdfpassword=foo

Many thanks in advance.  My boss is increasingly unamused and I'm out of
ideas.
-- 
Kirk Strauser
The Day Companies
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Some users can't view sent PDFs anymore

2006-08-17 Thread Gabriel Genellina

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


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] Some users can't view sent PDFs anymore

2006-08-17 Thread Kirk Strauser
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
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )