[Zope] getting parent document

Anders Holmbech Nielsen ahn@iuas.dk
Wed, 30 Aug 2000 08:26:54 +0200


Thanks for your answer. This would do too, but Stephan Richter gave 
me a nice way to do it. A dtml-method with the following:

<dtml-raw>

Because of acquisition this will result in the "document" being 
included in its whole.

His suggestions:

1.
html: contains the HTML code
viewMethod:  called like: viewMethod?file=html
<dtml-var "_[file]">

2. The best by far. Write your own little Zope object in Python that 
has only an id and a body.
Then you can say: URL/html/viewMethods
Inside viewMethods: <dtml-var body>

3. Well, I found solution 3 reading the DTML Method source code pretty quick.
inside viewMethod:
<dtml-var raw>  -- That returns the unprocessed body of the object 
and due to the acquisition behavior of DTML methods it looks one 
object up, which is html. so URL/html/viewMethod works


>Anders Holmbech Nielsen writes:
>  > I have a dtml-method called test which I want to use like:
>  >
>  > someurl/document/test
>  >
>  > and in the dtml-method I want to include the document in its whole.
>  >
>  > I have tried something with the URL like:
>  >
>  > <dtml-var <dtml-var URL1>> this offcourse dont work... but this neither...
>Try:
>
>	<dtml-var "PARENTS[0](_.None,_)">
>
>"PARENTS[0]" gives you the parent, in your case "someurl/document".
>Calling this object renders it.
>If you call it without parameters, you cut the namespace chain.
>If you pass "_.None,_", you pass the namespace explicitly.
>(This usually is done by DTML behind the scenes, but
>inside "...", you must do it yourself).
>
>
>Dieter

-- 

Regards

-------------------------------------------------
Anders Holmbech Nielsen | Tlf:  (+45) 70 22 56 00
Software Engineer       | Fax:  (+45) 70 22 57 00
Integrator Uniware A/S  | http:/www.integrator.dk