Hi, I've just got a quick question on acquisition... In my root folder, I have my index_html which contains, amongst other things: <td colspan="2"> <dtml-var contentPanel> </td> In the root folder, I have another DTML method called contentPanel, which is correctly displayed when I view the root folder. Now, under the root folder, I have the following folder structure: / `SiteUsers/ `Dan/ SiteUsers is empty, except for Dan; Dan contains a single DTML Method called contentPane. When I view localhost:8080/SiteUsers/Dan/ I would expect the contentPane from SiteUsers/Dan to be displayed (ie. index_html is being acquired by the Dan folder, but since there is a contentPanel in the Dan folder, that should 'override' the one in the root folder). However, I am getting the contentPane from the root folder. This is a namespace issue - how do I force Zope to use the correct namespace? My understanding was that all name resolution started at the place specified from the URL, and then worked back 'up' the tree... My experience here shows this is true, but the search URL always 'starts' from the object 'doing' the acquisition (index_html in this case) - hence the contentPane in Dan/ isn't being used. How should I solve this? Many thanks, Dan _________________________________________________________________ Daniel Fairs | daniel.fairs@spiderplant.net | www.spiderplant.net
Daniel Fairs wrote:
Hi,
I've just got a quick question on acquisition...
In my root folder, I have my index_html which contains, amongst other things:
<td colspan="2"> <dtml-var contentPanel> </td>
In the root folder, I have another DTML method called contentPanel, which is correctly displayed when I view the root folder.
Now, under the root folder, I have the following folder structure: / `SiteUsers/ `Dan/
SiteUsers is empty, except for Dan; Dan contains a single DTML Method called contentPane.
When I view localhost:8080/SiteUsers/Dan/ I would expect the contentPane from SiteUsers/Dan to be displayed (ie. index_html is being acquired by the Dan folder, but since there is a contentPanel in the Dan folder, that should 'override' the one in the root folder). However, I am getting the contentPane from the root folder. This is a namespace issue - how do I force Zope to use the correct namespace? My understanding was that all name resolution started at the place specified from the URL, and then worked back 'up' the tree... My experience here shows this is true, but the search URL always 'starts' from the object 'doing' the acquisition (index_html in this case) - hence the contentPane in Dan/ isn't being used.
How should I solve this?
Many thanks, Dan
I suspect index_html in the root is a DTML document. Try making it a DTML method. Documents alway execute in the context of their container, methods in the context of their caller. hth, -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
Guten Abend. * Daniel Fairs <daniel.fairs@spiderplant.net> [2001-05-25 17:30]:
Zope to use the correct namespace? My understanding was that all name resolution started at the place specified from the URL, and then worked back 'up' the tree... My experience here shows this is true, but the search URL
Nope. Acquistion means that the search first tries all the containers up to the root folder and _then_, if it didn't find the wanted object, evaluates the context. Containment before context. This is a very important Zope concept. I assume your index_html is a DTML document. This means that it has its own namespace. Your contentPanel isn't part of its namespace, so Zope tries to look it up in your index_html's container which happens to be the root folder. The solution is to use a DTML method. I know this was mentioned in an answer to your question, but without a full explanation of the reason. This is the reason: A method doesn't have his (or her) own namespace. It "lives" in the namespace of the object the method is called on. Any questions? :-) Cheers, Nils
participants (3)
-
Casey Duncan -
Daniel Fairs -
Nils Kassube