Weird acquisition behavior of Page Templates
Here's a puzzler... So we all know how you can use context acquisition by visiting various URLs in the browser, right? E.g. if let's say we have a folder in the zope root, called my_folder. Let's say it contains an image, a dtml method, and a page template called respectively my_image, my_dtml, and my_pt. Now we all know that if you browse to /my_folder/my_image/my_dtml, you'll see my_dtml rendered. my_image just gets added to its acquisition path. Likewise if you visit /my_folder/my_dtml/my_template, you'll see my_template rendered, with my_dtml at the end of the aq_chain. And if you visit /my_folder/my_template/my_dtml, you'll see my_dtml with my_template on the aq_chain. except the last one is not true. :-P As far as i can tell, if you put a page template anywhere in the URL, it gets rendered no matter what else comes after it in the URL. /my_folder/my_template/foo/bar/baz... no matter what, you get my_template rendered. what the hell is up with that? Bug? try it yourself. zope 2.6.1. -- Paul Winkler home: http://www.slinkp.com "Muppet Labs, where the future is made - today!"
Paul Winkler wrote:
As far as i can tell, if you put a page template anywhere in the URL, it gets rendered no matter what else comes after it in the URL. /my_folder/my_template/foo/bar/baz... no matter what, you get my_template rendered.
I can reproduce it with PageTemplates. It's the same behavior with PythonScripts anywhere in the URL. They are "catch-alls" and deliver the rest of the URL in the "traverse_subpath" of the REQUEST. This can be useful if you want to build "virtual urls". For PythonScripts this behavior is very, very, very useful, but I don't know if this is true for PageTemplates as well. Cheers, Maik
Dont know if its a bug, but if it is, it is by design. ZopePageTemplates inherit from Shared.DC.Scripts.Script.Script, which inherits from BindingsUI which inherits from Bindings, and theres a __before_publishing_traverse__ hook responsible for the "traverse_subpath" stuff. Not sure about the rationale for this myself. - peter. Paul Winkler wrote:
Here's a puzzler...
So we all know how you can use context acquisition by visiting various URLs in the browser, right? E.g. if let's say we have a folder in the zope root, called my_folder. Let's say it contains an image, a dtml method, and a page template called respectively my_image, my_dtml, and my_pt.
Now we all know that if you browse to /my_folder/my_image/my_dtml, you'll see my_dtml rendered. my_image just gets added to its acquisition path.
Likewise if you visit /my_folder/my_dtml/my_template, you'll see my_template rendered, with my_dtml at the end of the aq_chain.
And if you visit /my_folder/my_template/my_dtml, you'll see my_dtml with my_template on the aq_chain.
except the last one is not true. :-P
As far as i can tell, if you put a page template anywhere in the URL, it gets rendered no matter what else comes after it in the URL. /my_folder/my_template/foo/bar/baz... no matter what, you get my_template rendered.
what the hell is up with that? Bug?
try it yourself. zope 2.6.1.
On Mon, May 05, 2003 at 09:32:35AM +0200, Peter Sabaini wrote:
Dont know if its a bug, but if it is, it is by design.
ZopePageTemplates inherit from Shared.DC.Scripts.Script.Script, which inherits from BindingsUI which inherits from Bindings, and theres a __before_publishing_traverse__ hook responsible for the "traverse_subpath" stuff. Not sure about the rationale for this myself.
OK, thanks Peter, Mark, and Roger Espinosa who replied privately. something else weird must be going on because i've determined that this behavior was not causing us a problem on zope 2.5.1 but now, on 2.6.1, it is. but there's also a different proxy server involved so that may be part of the problem. still investigating... -- Paul Winkler home: http://www.slinkp.com "Muppet Labs, where the future is made - today!"
participants (3)
-
Maik Jablonski -
Paul Winkler -
Peter Sabaini