[Zope] Building Special Document Classes

Eric Roby vekn@msn.com
Tue, 29 May 2001 17:07:47 -0500

At the risk of asking a stupid question or what must seem obvious ... it no
longer is to me.

My current project requires that I create different document classes.  I
need for them to be CatalogAware, editable through the management interface
and fully renderable.  I have been able to create a structured document
ZClass, but I have not been able to create an HTML document ZClass that is
both CatalogAware and renderable.  If I create a ZClass that is based on
CatalogAware and DTMLDocument, use the default manage_main method for the
Edit View, the instance is rendered properly but the Catalog is not updated
(as I would expect).  If I create my own method (to kick-off the
reindex_object method) and hook it to the Edit View, I can update the
Catalog but the document instance is no longer renderable (I get a file
download dialog).

My first attempt at the HTML document class was just to use CatalogAware as
my base class and hand build my constructors and class methods.  I ended up
with a document class that was CatalogAware and renderable, however the HTML
tags were wrapped in brackets when viewed.  So obviously the DTMLDocument
class tells the ZPublisher to render it as HTML.  This detail is not obvious
to me - looking at the code.

I know that there is an HTMLDocument product available but it was not
designed to allow editing/composing TTW, only file upload.

I have read the new Zope Book, all the How-To's, tried to read the code, but
nothing that I have seen explains what I am doing wrong.  This is a very
fundamental aspect of Zope that I need to get past and should be able to get
from the available literature.

Anyone have any insight - thoughts - experiences - pointers - directions ...

Thanks in advance.