[Zope] manage_addDTMLDocument

Casey Duncan cduncan@kaivo.com
Thu, 08 Mar 2001 08:24:58 -0700


nuno wrote:
> 
> Hi All !
> I'm trying to add a dtml-document to my site, still i am having some
> problems with the location.
> 
> If i write something like:
> <dtml-call
> "PARENTS[0].DIR.manage_addDTMLDocument(id=pagename,title=pagetitle,file=page
> )">
> 
> It creates all fine : )
> 
> BUT...
> If the location where i want to create the DTML Document, is recieved like a
> parameter
> All goes wrong...
> (something like)
> 
> <dtml-var location>  -> has the string 'PARENTS[0].DIR1.DIR2' which is the
> place where i desire to create the document.then i try this:
> <dtml-call
> "_[location].manage_addDTMLDocument(id=pagename,title=pagetitle,file=page)">
> 
> I think this is more a string problem,
> anyway if anyone had this problem or have any idea how to get over this,
> i'll be apreciatted
> 
> thanks in advance
> regards
> Nuno
> 

Assuming "location" is the id of the object, this will work:

<dtml-call
expr="_.getitem(location).manage_addDTMLDocument(id=pagename,title=pagetitle,file=page)">

_[location] actually calls the object, whereas _.getitem() doesn't, it
just returns the object itself.

Now, if location is a path like: '/folder1/folder2/folder3' then use
this something like:

<dtml-with expr="REQUEST.resolve_url(location)">
	<dtml-call
expr="manage_addDTMLDocument(id=pagename,title=pagetitle,file=page)">
</dtml-with>

You cannot however pass Python expressions like 'PARENTS[0].DIR1.DIR2'
as strings and evaluate them in DTML AFAIK. Try passing the URL instead
as above.

-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>