Re: Zope digest, Vol 1 #635 - 61 msgs
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
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
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
On Thu, 17 Feb 2000, Tres Seaver wrote:
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:
[snip]
2. Make the STX_Document class "renderable":
[snip]
I don't know whether to introduce the dependency on Lalo's product, but this workaround should solve your problem.
I posted a third alternative last night, under the subject "StructuredDocument". Basically, I got a ZClass to render fine as index_html by overloading its __call__ method in a Python base class. The problem, as I understand it, is that Zope does not look for the index_html of an object called index_html. It short circuits. So, you can't rely on the index_html inside the ZClass being rendered, and must return the results to the browser in another manner. One way is to use Renderable ZClass, which I considered but did not try. The other is to overload __call__, which I did and it seemed to work. I don't have the time to implement this "correctly", now, unfortunately, but will get to it in the future if no one else does by then. --Jeff --- Jeff K. Hoffman 704.849.0731 x108 Chief Technology Officer mailto:jeff@goingv.com Going Virtual, L.L.C. http://www.goingv.com/
Tres, thanks for the how-to....I was able to follow your instructions and it now works with index_html....thanks for your efforts and for a very useful product. Darcy Tres Seaver wrote:
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
-- --------------------------------------------------- Ph: (734) 764 3377 Email: darcyc@engin.umich.edu URL: http://www-personal.engin.umich.edu/~darcyc/ --------------------------------------------------- 'If you're not part of the solution, you're part of the precipitate' ..... Steven Wright
On Thu, Feb 17, 2000 at 10:55:48AM -0600, Tres Seaver wrote:
I don't know whether to introduce the dependency on Lalo's product, but this workaround should solve your problem.
You don't need to subclass Renderable for a python-based class; I designed it for ZClasses. If your class is python-based, then it's already ``renderable'' - all you have to do is provide a __str__ method. []s, |alo +---- -- I am Lalo of deB-org. You will be freed. Resistance is futile. http://www.webcom.com/lalo mailto:lalo@webcom.com pgp key in the web page Debian GNU/Linux --- http://www.debian.org Brazil of Darkness -- http://zope.gf.com.br/BroDar
Lalo Martins wrote:
On Thu, Feb 17, 2000 at 10:55:48AM -0600, Tres Seaver wrote:
I don't know whether to introduce the dependency on Lalo's product, but this workaround should solve your problem.
You don't need to subclass Renderable for a python-based class; I designed it for ZClasses. If your class is python-based, then it's already ``renderable'' - all you have to do is provide a __str__ method.
STX_Document _is_ a ZClass-based product -- almost the simplest possible one. I experimented with morphin it to derive from Renderable in order to allow instances of STX_Document to be used as the index_html of a folder. I am beginning to think we need to persuade DC to fold your Renderable change into _ZClass_for_Object, or whatever it is called. Tres. -- ========================================================= Tres Seaver tseaver@palladion.com 713-523-6582 Palladion Software http://www.palladion.com
On Thu, Feb 17, 2000 at 02:41:10PM -0600, Tres Seaver wrote:
I am beginning to think we need to persuade DC to fold your Renderable change into _ZClass_for_Object, or whatever it is called.
Are you listening, DC? :-) Seriously, I agree. I didn't write Renderable to ``add a revolutionary feature'', but instead (in my point of view) to fix a huge gap. It's nice that I can make a ZClass browseable by just giving it an index_html, but it's strange that there isn't a comparably simple way to allow <dtml-var myobj>. []s, |alo +---- -- I am Lalo of deB-org. You will be freed. Resistance is futile. http://www.webcom.com/lalo mailto:lalo@webcom.com pgp key in the web page Debian GNU/Linux --- http://www.debian.org Brazil of Darkness -- http://zope.gf.com.br/BroDar
participants (4)
-
Darcy Clark -
Jeff K. Hoffman -
Lalo Martins -
Tres Seaver