acquisition vs. inheritance
I am slowly getting the hang of Zope, but am confused about something. Either I don't understand how acquisition works, or there is something special about how index_html is treated. I had a folder with a index_html that had something like: <dtml-var standard_html_header> <dtml-var content> <dtml-var standard_html_footer> Then in the top level folder, I had a "content" object that I filled in with text. In a subfolder, I created a content object, but it didn't seem to override the upper layer one unless I copied down a copy of index_html. I would have thought it would have gone up a layer for index_html, but then would have discovered content at the lower layer. It seems this would be very powerful, but I am guessing there is a good reason. I wondered why standard_html_header and standard_html_footer seemed to be used everywhere, but I am starting to see, I think why. Is it possible to have just one top level object that refers to other objects that get overridden as you go into other folders?
Bob Horvath wrote:
I would have thought it would have gone up a layer for index_html,
but then would have discovered content at the lower layer.
Sounds like your index_html is a DTML Document when it should be a DTML method... cheers, Chris
Is it possible to have just one top level object that refers to other objects that get overridden as you go into other folders?
Acquisition works the other way around. You can create objects in subfolders whose contents are overriden higher up. You can't have an object at the top whose contents get overridden as you go down. Your solution was correct. Create another index_html in the subfolder, which uses the 'contents' object in the subfolder, but the standard_html_header and standard_html_footer from the parent folder. --jfarr "Perl is worse than Python because people wanted it worse." Larry Wall, 14 Oct 1998
Jonothan Farr wrote:
Is it possible to have just one top level object that refers to other objects that get overridden as you go into other folders?
Acquisition works the other way around. You can create objects in subfolders whose contents are overriden higher up. You can't have an object at the top whose contents get overridden as you go down.
Urm, I think wires are getting crossed here, so here's an example which may help (and which we use on most of our sites): index_html is a DTML method: <dtml-var standard_html_header> <dtml-var index.html> <dtml-var standard_html_footer> Now, in each folder we have DTML documents called index.html which actually contain the pages. So, we have one index_html and many index.html's. When someone does http://www.mysite.com/folder/ This actually renders http://www.mysite.com/folder/index_html Then, index_html is acquired from the root. However, because index.html exists is /folder, it is that which is displayed. I hope this makes it a little clearer :S cheers, Chris PS:
Your solution was correct. Create another index_html in the subfolder,
As long as index_html is a method, you only need one of them, in the root.
which uses the 'contents' object in the subfolder,
This will still happen if there's only one index_html
Dang! Just when I think I understand this acquisition thing. ;) Sorry for the misinformation. --jfarr "Perl is worse than Python because people wanted it worse." Larry Wall, 14 Oct 1998 ----- Original Message ----- From: Chris Withers <chrisw@nipltd.com> To: Jonothan Farr <jfarr@real.com> Cc: Bob Horvath <bob@horvath.com>; <zope@zope.org> Sent: Friday, August 04, 2000 1:54 AM Subject: Re: [Zope] acquisition vs. inheritance
Jonothan Farr wrote:
Is it possible to have just one top level object that refers to other objects that get overridden as you go into other folders?
Acquisition works the other way around. You can create objects in subfolders whose contents are overriden higher up. You can't have an object at the top whose contents get overridden as you go down.
Urm, I think wires are getting crossed here, so here's an example which may help (and which we use on most of our sites):
index_html is a DTML method:
<dtml-var standard_html_header> <dtml-var index.html> <dtml-var standard_html_footer>
Now, in each folder we have DTML documents called index.html which actually contain the pages.
So, we have one index_html and many index.html's.
When someone does http://www.mysite.com/folder/ This actually renders http://www.mysite.com/folder/index_html Then, index_html is acquired from the root. However, because index.html exists is /folder, it is that which is displayed.
I hope this makes it a little clearer :S
cheers,
Chris
PS:
Your solution was correct. Create another index_html in the subfolder,
As long as index_html is a method, you only need one of them, in the root.
which uses the 'contents' object in the subfolder,
This will still happen if there's only one index_html
participants (3)
-
Bob Horvath -
Chris Withers -
Jonothan Farr