Replacing index_html with index.html
Hello everyone: I am trying to display "index.html" in a folder instead of index_html by default. This is what I put in my "index_html" in the root folder: <dtml-if index.html> <html> <head> <title>Redirection</title> <meta http-equiv="refresh" content="0; URL=&dtml-absolute_url;/index.html"> </head> <body> </body> </html> </dtml-if> It used to work just fine with Zope 2.3.3, but after upgrading to Zope 2.6.1 it fails with the message: Error Type: TypeError Error Value: __call__() takes exactly 2 arguments (1 given) Can anyone help? Thank you very much! Nic
Why not just do the redirect in the response? Something like this: req = container.REQUEST defaults = ['index.html', 'index.htm'] for default in defaults: if context.hasattr(default): req.RESPONSE.redirect('%s/%s' % (req.absolute_url(), default)) break Sorry, that didn't really answer your question but perhaps it solves the problem... Chris Niclas Kuehne wrote:
Hello everyone:
I am trying to display "index.html" in a folder instead of index_html by default. This is what I put in my "index_html" in the root folder:
<dtml-if index.html> <html> <head> <title>Redirection</title> <meta http-equiv="refresh" content="0; URL=&dtml-absolute_url;/index.html"> </head> <body> </body> </html> </dtml-if>
It used to work just fine with Zope 2.3.3, but after upgrading to Zope 2.6.1 it fails with the message:
Error Type: TypeError Error Value: __call__() takes exactly 2 arguments (1 given)
Can anyone help?
Thank you very much! Nic
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
This can be done quite a bit more easily: Put this in index_html: <dtml-var "_['index.html']"> Ta da! If you abosolutely *must* redirect, try this: <dtml-call "RESPONSE.redirect(URL1 + '/index.html')"> But it's better not to depend on redirection, if you can avoid it. It's not 100% supported in all browsers. HTH, Dylan
Thank you very much for your response! I had tried <dtml-var "_['index.html']"> before, but I get the same error message: Error Type: TypeError Error Value: __call__() takes exactly 2 arguments (1 given) I created a DTML Documnt "foobar" and tried <dtml-var "_['foobar']"> It works! The idea is right, but there seems to be a problem when parsing special characters such as "." in an object's id. This seems to be a new problem/feature in Zope Version 2.6.1, as it works fine in previous versions (2.3.3). Any other thoughts on this? Nic On April 1, 2003 09:43 pm, Dylan Reinhardt wrote:
This can be done quite a bit more easily:
Put this in index_html:
<dtml-var "_['index.html']">
Ta da!
If you abosolutely *must* redirect, try this:
<dtml-call "RESPONSE.redirect(URL1 + '/index.html')">
But it's better not to depend on redirection, if you can avoid it. It's not 100% supported in all browsers.
HTH,
Dylan
Hello everyone:
I am trying to display "index.html" in a folder instead of index_html by default. This is what I put in my "index_html" in the root folder:
<dtml-if index.html> <html> <head> <title>Redirection</title> <meta http-equiv="refresh" content="0; URL=&dtml-absolute_url;/index.html"> </head> <body> </body> </html> </dtml-if>
It used to work just fine with Zope 2.3.3, but after upgrading to Zope 2.6.1 it fails with the message:
Error Type: TypeError Error Value: __call__() takes exactly 2 arguments (1 given)
Can anyone help?
Thank you very much! Nic
On Tue, 2003-04-01 at 22:41, Niclas Kuehne wrote:
Thank you very much for your response!
No problem.
The idea is right, but there seems to be a problem when parsing special characters such as "." in an object's id. This seems to be a new problem/feature in Zope Version 2.6.1, as it works fine in previous versions (2.3.3).
I don't think that's your problem. You can verify this works by using <dtml-var "_['index.html']"> to call a trivial index.html method. Works fine for me. My guess is that the error is happening *in* index.html. Given your error message, I'd look first at places where you call methods with zero arguments (implied self) or one explicit argument.. It's quite possible that the interface to something you call has changed and that it now requires one more argument than you're currently supplying. If you're new to 2.6, you may or may not already know about the new error_log object. If you haven't already seen it, it's in the root and well worth checking out. It may help illuminate the source of your problem. Feel free to post some code and tracebacks when you narrow down where the error is showing up. HTH, Dylan
On April 2, 2003 03:54 am, Dylan Reinhardt wrote: Thanks again for the help! I created a trivial DTML Document called "index.html" and it works fine. This narrows the problem down a little bit. The reason the error comes up seems to root in the "Unified HTMLDocument" http://dev.zope.org/Members/lheber/software Product that I am using to automatically add the "standard_html_header" and footer to all uploaded files. This is a requirement for the project... It seems that Unified HTML Documents can not be called this way. I don't know exactly where the error is. Is there any other way to implement a control that adds the "standard_html_header" and footer information automatically and replaces eveything except for the body of a document during upload? I used to use the HTMLDocument Product but I can't get it to work with Zope 2.6.1... Niclas Kuehne
On Tue, 2003-04-01 at 22:41, Niclas Kuehne wrote:
Thank you very much for your response!
No problem.
The idea is right, but there seems to be a problem when parsing special characters such as "." in an object's id. This seems to be a new problem/feature in Zope Version 2.6.1, as it works fine in previous versions (2.3.3).
I don't think that's your problem. You can verify this works by using <dtml-var "_['index.html']"> to call a trivial index.html method. Works fine for me.
My guess is that the error is happening *in* index.html.
Given your error message, I'd look first at places where you call methods with zero arguments (implied self) or one explicit argument.. It's quite possible that the interface to something you call has changed and that it now requires one more argument than you're currently supplying.
If you're new to 2.6, you may or may not already know about the new error_log object. If you haven't already seen it, it's in the root and well worth checking out. It may help illuminate the source of your problem.
Feel free to post some code and tracebacks when you narrow down where the error is showing up.
HTH,
Dylan
Niclas Kuehne wrote at 2003-4-2 09:55 -0600:
On April 2, 2003 03:54 am, Dylan Reinhardt wrote: I created a trivial DTML Document called "index.html" and it works fine. This narrows the problem down a little bit. The reason the error comes up seems to root in the "Unified HTMLDocument"
This means, you must not call the object when you want to check its existence (as "<dtml-if object>" does). You can use <dtml-if "_.has_key('index.html')"> Dieter
Dylan Reinhardt wrote:
This can be done quite a bit more easily:
Put this in index_html:
<dtml-var "_['index.html']">
Whats wrong with <dtml-var index.html> ? This is obviously dependent upon having an index.html object. -- Andy McKay
On Wed, 2003-04-02 at 03:22, Andy McKay wrote:
Dylan Reinhardt wrote:
This can be done quite a bit more easily:
Put this in index_html:
<dtml-var "_['index.html']">
Whats wrong with <dtml-var index.html> ?
Uh... it's not obscure enough? :-) I'm not sure how I got in the habit of thinking that notation was required for dotted names. Was it ever necessary? Maybe there should be a Zope equivalent of the Useless Use Of Cat Award ( http://www.sektorn.mooo.com/era/unix/award.html ) I'd suggest the Useless Use Of _ Award... UUO_A would be a great acronym. Dylan
On Thursday 03 April 2003 00:40, Dylan Reinhardt wrote:
On Wed, 2003-04-02 at 03:22, Andy McKay wrote:
Dylan Reinhardt wrote:
This can be done quite a bit more easily:
Put this in index_html:
<dtml-var "_['index.html']">
Whats wrong with <dtml-var index.html> ?
Uh... it's not obscure enough? :-)
I'm not sure how I got in the habit of thinking that notation was required for dotted names. Was it ever necessary?
i think it's necessary if we're using expression as in: <dtml-var "index.html">, or <dtml-var expr="index.html"> now that means totally different to <dtml-var index.html> your escaping stuff is a habit, a safety net, methinks. i have that habit too ;)
Maybe there should be a Zope equivalent of the Useless Use Of Cat Award ( http://www.sektorn.mooo.com/era/unix/award.html ) I'd suggest the Useless Use Of _ Award... UUO_A would be a great acronym.
Dylan
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Actually, what you'd probably be most interested in is this: http://dev.zope.org/Wikis/DevSite/Proposals/ObjectTypeAssociationAndDeathToI... Last I heard it was delayed from the 2.6 series, but perhaps will make it in 2.7. However, it seems some of the code opening up the possibility for this has made it into the code--have a look at <Zope>/lib/python/ZPublisher. Look specifically at BaseRequest.py and search for __browser_default__. Perhaps Casey can explain more about his vision and the status of this. That old index_html -> index.html refresh is an old, tired hack. HTH, Eron On Tuesday April 1 2003 9:30 pm, Niclas Kuehne wrote:
Hello everyone:
I am trying to display "index.html" in a folder instead of index_html by default. This is what I put in my "index_html" in the root folder:
<dtml-if index.html> <html> <head> <title>Redirection</title> <meta http-equiv="refresh" content="0; URL=&dtml-absolute_url;/index.html"> </head> <body> </body> </html> </dtml-if>
It used to work just fine with Zope 2.3.3, but after upgrading to Zope 2.6.1 it fails with the message:
Error Type: TypeError Error Value: __call__() takes exactly 2 arguments (1 given)
Can anyone help?
Thank you very much! Nic
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) --- [This E-mail scanned for viruses by Declude Virus]
-- Eron Lloyd Technology Coordinator Lancaster County Library elloyd@lancaster.lib.pa.us Phone: 717-239-2116 Fax: 717-394-3083 --- [This E-mail scanned for viruses by Declude Virus]
Eron Lloyd wrote:
Actually, what you'd probably be most interested in is this: http://dev.zope.org/Wikis/DevSite/Proposals/ObjectTypeAssociationAndDeathToI...
Last I heard it was delayed from the 2.6 series, but perhaps will make it in 2.7. However, it seems some of the code opening up the possibility for this has made it into the code--have a look at <Zope>/lib/python/ZPublisher. Look specifically at BaseRequest.py and search for __browser_default__. Perhaps Casey can explain more about his vision and the status of this. That old index_html -> index.html refresh is an old, tired hack.
Its there, just the nice ZMI interface has never been added so you still need to do a bit of work. Its in Plone BTW :) -- Andy McKay
participants (7)
-
Andy McKay -
Bakhtiar A Hamid -
Chris Beaven -
Dieter Maurer -
Dylan Reinhardt -
Eron Lloyd -
Niclas Kuehne