[Zope] StructuredDocuments
Tres Seaver
tseaver@palladion.com
Thu, 17 Feb 2000 11:06:31 -0600
Jeff Hoffman <jeff@goingv.com> wrote:
>
> Hey, guys.
>
> For what it's worth, I got a simple StructuredDocument ZClass to work,
> even when used as index_html. Here's how:
>
> I created a Python product called StructuredDocumentBase that included a
> class of the same name. This class is defined as follows:
>
> from OFS.DTMLDocument import DTMLDocument
> from StructuredText.StructuredText import html_with_references
>
> class StructuredDocumentBase:
> """Mix-in for StructuredDocument ZClass."""
> def __call__(self, client = None, REQUEST = {}, RESPONSE = None,
> **kw):
> """Render the document given a client object, REQUEST mapping,
> response, and keyword arguments."""
> header = apply(self.standard_html_header.__call__,
> (client, REQUEST),
> kw)
> body = html_with_references(apply(DTMLDocument.__call__,
> (self, client, REQUEST),
> kw))
> footer = apply(self.standard_html_footer.__call__,
> (client, REQUEST),
> kw)
> return '%s%s%s' % (header, body, footer)
>
> Then, I created another product called StructuredDocument, this time
> through the web. In this product, I created a ZClass called
> StructuredDocument, which inherits first from StructuredDocumentBase and
> then from DTMLDocument.
>
> Then, I placed an instance in a folder, navigated to the URL, and it
> worked.
>
> I would package it up and upload it as a product, but a part of it is
> broken--I can't rename the instance. This has nothing to do (AFAICT) with
> the __call__ voodoo above, but seems to be due to my inheriting from
> DTMLDocument; I created a simple ZClass that did nothing except inherit
> from DTMLDocument and it exhibited the same behavior.
>
> Anyways, Tres (or anyone using Tres's product), if you want to take this
> idea and integrate it into your STX_Document class that'd be cool. If not,
> I'll make a more complete (and tested) implementation when I can find the
> time.
Ooops, I didn't read far enough forward. I just posted a modification to the
ZClass solution which uses Lalo's RenderableZClass product to fix the problem.
I haven't uploaded the modified STX_Document product, because I'm still
wrestling with whether to force the dependency on Lalo's product.
Tres.
--
=========================================================
Tres Seaver tseaver@palladion.com 713-523-6582
Palladion Software http://www.palladion.com