[Zope] Re: Zope digest, Vol 1 #635 - 61 msgs
Tres Seaver
tseaver@palladion.com
Thu, 17 Feb 2000 10:55:48 -0600
Darcy Clark <darcyc@engin.umich.edu> wrote:
> Reply-To: darcyc@engin.umich.edu
> Organization: MSE, Umich
> To: zope@zope.org
> Subject: [Zope] STX_Document
>
> I am having some trouble with using STX_Document with objects named
> index_html. I've worked out that index_html method is used by the ZClass
> when the STX_Document is viewed. For instance if I create a folder
> "test" and then add an STX_Document to the folder called "index_html",
> then point the browser to
>
> http://server/test/
>
> I get :
>
> Zope Error
> Zope has encountered an error while publishing this resource.
> Resource not found
>
> Is there a way around this problem...
Jeff Hoffman <jeff@goingv.com> wrote:
> To: Darcy Clark <darcyc@engin.umich.edu>
> Cc: zope@zope.org
> Subject: Re: [Zope] STX_Document
>
> On Wed, 16 Feb 2000, Darcy Clark wrote:
>
> > I am having some trouble with using STX_Document with objects named
> > index_html. I've worked out that index_html method is used by the ZClass
> > when the STX_Document is viewed. For instance if I create a folder
> > "test" and then add an STX_Document to the folder called "index_html",
> > then point the browser to
> >
> > http://server/test/
> >
> > I get :
> >
> > Zope Error
> > Zope has encountered an error while publishing this resource.
> > Resource not found
> >
> > Is there a way around this problem...
>
> I saw it mentioned on one of the lists last week (or sometime around then)
> that index_html is treated differently by Zope. It seems that Zope does
> not look for an index_html when navigating to an object called index_html.
>
> Perhaps this could be fixed by rewriting the STX_Document object such that
> it does not rely on index_html for its representation, but uses __str__
> instead. Of course, this would require some Python underneath the existing
> ZClass stuff.
>
> I have big plans for structured text, as we plan on using it extensively
> in our work. Fixing this issue would definitely be a (small) part of that
> work. However, I don't know where this fits into my timeline. When the
> time is closer, I'll make sure to share my work with the community so that
> everyone benefits.
Hmmm, I tried a couple of things:
1. Rename the STX_Document to 'index_stx', and then try various hacks
at to render it within a "generic" 'index_html' DTML Method:
- '<dtml-var index_stx>' doesn't render correctly
- Nor does '<dtml-var "_.render( index_stx )">
- '<dtml-call "RESPONSE.redirect( 'index_stx' )">' does, but it munges
the URL as visible to the user.
2. Make the STX_Document class "renderable":
- Add a new ZClass, RSTX_Document to the product, subclassing from
the Renderable base class in Lalo's "Renderable
product":http://www.zope.org/Members/lalo/RenderableZClass and from
CatalogAware (in that order).
- Copy the property sheets and methods from STX Document, and duplicate
the Views tab.
- Copy and paste the 'index_html' method and rename the copy to 'render'.
- Add an RSTX_Document named 'index_html' to a folder. View the folder.
**THIS WORKS!**
I don't know whether to introduce the dependency on Lalo's product, but this
workaround should solve your problem.
--
=========================================================
Tres Seaver tseaver@palladion.com 713-523-6582
Palladion Software http://www.palladion.com