[Zope] Additional HTML-Header on ZServer FTP-get

Amos Latteier amos@aracnet.com
Tue, 08 Jun 1999 11:51:05 -0700


At 07:48 PM 6/8/99 +0200, Stefan Bund wrote:
>
>After I have read about ZServer and the FTP access method, I was really
>intrigued by the possibility to use emacs+ange-ftp to easily manage
>Zope Documents.
>
>After a bit of struggling with the Zope configuration I got it
>working: I LOVE emacs: I can open a file
>'/localhost:8021:/standard_html_header', edit it and then save it with
>C-x C-s and it will be changed in the Zope-Database. Cool. (I patched
>ange-ftp to support Port Numbers though...)

Yes this is very cool. BTW, EFS already supports FTP port numbers.

>Now to the Problem: Whenever I open a DTML-Document or DTML-Method,
>ZServer seams to add '<html><head></head>' as the first line. Saving
>the changed document then saves this additional HTML-Header... Bad...
>
>Is this a (known?) Bug in ZServer?

This is an known and fixed bug. Unfortunately that doesn't help you right
now unless you want to upgrade to the latest unstable release.

>Another question: How does ZServer determine the type of Object to
>Add when put-ing a new File?

This is not some much a ZServer issue as a Zope PUT handling issue. For the
most part the same code that handles FTP put handles HTTP PUT and WebDAV put.

Basically Zope looks for a content-type header on the request, barring
that, it uses the mimetypes module to guess the mime-type from the file
extension. Then it creates a Zope object that it chooses as most closely
matching the content-type.

Of course there are problems with this approach. What if you create a Z
Class and want to associate a file extension or a mime-type with it? What
if you want DTML Documents, rather than DTML Methods to be created by PUT?
What if you want WebDAV puts to treat .txt files differently than FTP puts?
Etcetera, etcetera.

I don't think this issue has been a priority for anyone so far. If it is
for you, we're open to suggestions. (And patches ;-)

-Amos