Hi, I'm having a problem using a ZClass as a default view of a folder: When I add a ZClass instance to '/folderX', give it an id of 'index_html', and browse to '/folderX', I get an empty response. when I browse to '/folderX/index_html' I still get this error. when I browse to '/folderX/index_html/index_html' I get the correct page. The Zclass has ZObject as base class, and an index_html method I added. Is there a way to make a browse request to '/folderX' execute the index_html method of the index_html ZClqss in that folder? PS: this is the actual response I get from zope (and also lists the zope config I'm using): HTTP/1.0 200 OK Server: Zope/Zope 2.3.2 (source release, python 1.5.2, linux2) ZServer/1.1b1 Date: Thu, 19 Jul 2001 14:55:27 GMT Content-Type: text/x-unknown-content-type Content-Length: 0 -- Maarten Slaets Contact: http://zope.neolabs.be/home/maarten/maarten.vcf
Smells like a bug. I tried it too and it doesn't make sense. With a humble rename from "something" to "index_html" or "index_html" to "somethingelse" you go from 200 to 404 or 404 to 200. Go to http://classic.zope.org:8080/Collector and search if the bug is already there (yes, the search is tricky but is being replaced to something even more complicated) If it isn't, report it. What I don't understand is that all products (all meta types) are instances of classes and many of them have methods called index_html or define it as a link to a method using the __str__. There must be some golden rules about naming objects to index_html As a sidenote, create an instance and call it something less Zoponic and in the ZClass create an object called index_html instead. "better practice". Cheers, Peter
Hi,
I'm having a problem using a ZClass as a default view of a folder:
When I add a ZClass instance to '/folderX', give it an id of 'index_html', and browse to '/folderX', I get an empty response. when I browse to '/folderX/index_html' I still get this error. when I browse to '/folderX/index_html/index_html' I get the correct page.
The Zclass has ZObject as base class, and an index_html method I added.
Is there a way to make a browse request to '/folderX' execute the index_html method of the index_html ZClqss in that folder?
PS: this is the actual response I get from zope (and also lists the zope config I'm using):
HTTP/1.0 200 OK Server: Zope/Zope 2.3.2 (source release, python 1.5.2, linux2) ZServer/1.1b1 Date: Thu, 19 Jul 2001 14:55:27 GMT Content-Type: text/x-unknown-content-type Content-Length: 0
-- Maarten Slaets Contact: http://zope.neolabs.be/home/maarten/maarten.vcf
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Peter Bengtsson wrote:
The Zclass has ZObject as base class, and an index_html method I added.
Is there a way to make a browse request to '/folderX' execute the index_html method of the index_html ZClqss in that folder?
Did you set the View method of your ZClass to index_html ? Check the 'Views' tab of your ZClass. You also want it to be first in the list. HTH, -- Tim Cook, President - Free Practice Management, Inc. http://www.FreePM.com Office: (731) 884-4126 ONLINE DEMO: http://www.freepm.org:8080/FreePM
Peter Bengtsson wrote:
The Zclass has ZObject as base class, and an index_html method I added.
Is there a way to make a browse request to '/folderX' execute the index_html method of the index_html ZClqss in that folder?
Did you set the View method of your ZClass to index_html ? Check the 'Views' tab of your ZClass. You also want it to be first in the list.
In my dummy reproduction example I never looked at that, but I found that the value of the id mattered a lot.
Tim Cook wrote:
Peter Bengtsson wrote:
The Zclass has ZObject as base class, and an index_html method I added.
Is there a way to make a browse request to '/folderX' execute the index_html method of the index_html ZClqss in that folder?
Did you set the View method of your ZClass to index_html ? Check the 'Views' tab of your ZClass. You also want it to be first in the list.
It didn't solve it. I did notice a difference though for a plain ZClass and a DTMLDoc subclassed ZClass.
HTH, -- Tim Cook, President - Free Practice Management, Inc. http://www.FreePM.com Office: (731) 884-4126 ONLINE DEMO: http://www.freepm.org:8080/FreePM
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- Maarten Slaets Contact: http://zope.neolabs.be/home/maarten/maarten.vcf
Peter Bengtsson wrote:
Smells like a bug.
I tried it too and it doesn't make sense. With a humble rename from "something" to "index_html" or "index_html" to "somethingelse" you go from 200 to 404 or 404 to 200.
thanks for trying it aswell.
Go to http://classic.zope.org:8080/Collector and search if the bug is already there (yes, the search is tricky but is being replaced to something even more complicated) If it isn't, report it.
I did that now, and I think you are right that its a bug http://classic.zope.org:8080/Collector/476/view It's been 'pending' since august '99 :(
What I don't understand is that all products (all meta types) are instances of classes and many of them have methods called index_html or define it as a link to a method using the __str__.
As far as I understand the Renderable class lets you bind a ZClass method to __str__ , but it didn't solve this issue. -- Maarten Slaets Contact: http://zope.neolabs.be/home/maarten/maarten.vcf
Peter Bengtsson wrote:
As a sidenote, create an instance and call it something less Zoponic and in the ZClass create an object called index_html instead. "better practice".
I made a workaround: since I was using a root 'index_html' method which checks for index.html files, I could modify that method to first check for instances of my ZClass with ID index.html. This is the dtml: <dtml-call "REQUEST.set('zclassindexfound', '0')"> <dtml-in "objectItems(['Custom Doc'])"> <dtml-with sequence-item> <dtml-if "_['id'] == 'index.html'"> <dtml-call "REQUEST.set('zclassindexfound', '1')"> <dtml-var index_html> </dtml-if> </dtml-with> </dtml-in> <dtml-unless "_['zclassindexfound'] == 1"> <dtml-try> <dtml-var expr="_['index.html']"> <dtml-except KeyError> <H1>Forbidden</H1> You don't have permission to access <dtml-var absolute_url> on this server.<P> </BODY></HTML> </dtml-try> </dtml-unless> When I have the time I will change this though, because this method is a performance killer. -- Maarten Slaets Contact: http://zope.neolabs.be/home/maarten/maarten.vcf
Well, the not performance killing workaround was not to name the instance index_html and instead have an index_html in the ZClass. That solves your problems for the moment. ----- Original Message ----- From: "Maarten Slaets" <maarten.slaets@neolabs.be> To: "Peter Bengtsson" <mail@peterbe.com> Cc: <zope@zope.org> Sent: Friday, July 20, 2001 12:05 PM Subject: Re: [Zope] ZClass index_html question
Peter Bengtsson wrote:
As a sidenote, create an instance and call it something less Zoponic and in the ZClass create an object called index_html instead. "better practice".
I made a workaround: since I was using a root 'index_html' method which checks for index.html files, I could modify that method to first check for instances of my ZClass with ID index.html.
This is the dtml:
<dtml-call "REQUEST.set('zclassindexfound', '0')"> <dtml-in "objectItems(['Custom Doc'])"> <dtml-with sequence-item> <dtml-if "_['id'] == 'index.html'"> <dtml-call "REQUEST.set('zclassindexfound', '1')"> <dtml-var index_html> </dtml-if> </dtml-with> </dtml-in>
<dtml-unless "_['zclassindexfound'] == 1"> <dtml-try> <dtml-var expr="_['index.html']"> <dtml-except KeyError> <H1>Forbidden</H1> You don't have permission to access <dtml-var absolute_url> on this server.<P> </BODY></HTML> </dtml-try> </dtml-unless>
When I have the time I will change this though, because this method is a performance killer.
-- Maarten Slaets Contact: http://zope.neolabs.be/home/maarten/maarten.vcf
participants (3)
-
Maarten Slaets -
Peter Bengtsson -
Tim Cook