Jim Washington wrote:
> Still playing with Dojo. Very Nice! :)
> I'm having a problem with content-type for items served from a
> resourceDirectory.
> In particular, one piece of dojo, a file with a .html extension begins
> with <?xml version="1.0" encoding="UTF-8"?>.  The DOCTYPE says XHTML 1.0
> Strict, but Zope3 returns it as text/plain (X-Content-Type-Warning:
> guessed from content).
> Unfortunately, that is a problem, because the client looks at
> content-type to decide how to parse.
> If I set the content-type to text/html, it works OK.
> So, is this a Dojo bug or a Zope3 bug?
Hearing none, the answer is:


Neither. :)

Purely static files can be served just fine through zope.paste.  No need
to bother Zope 3 at all to do this.

Quick recipe:

1.  install zope.paste, Paste, PasteDeploy

2.  in the [Zope3 instance]/etc folder, paste.ini can look like (this
somewhat complicated example uses my gzipper as a middleware filter):

use = egg:Paste#urlmap
/ = zope3
/@@/dojo = dojo

pipeline = gzipper main

paste.app_factory = zope.paste.application:zope_publisher_app_factory

filter-with = gzipper

nocompress=jp gz zip

Something similar should work for any static or third-party content. 
Maybe a /static/images directory?  This may be old hat to some, but I
thought I would share. 

A small but important caveat: Paste.urlmap (0.9) does not seem to like
:port in urls at the moment, so no http://localhost:8180 for now.  Zope3
can be listening at 8180, but you need a non-port alias for everything
to work properly.  Of course, it is possible I have a local
misconfiguration somewhere that makes this break.

wsgi+zope=very cool!

-Jim Washington

Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to