[Zope] convert strings to objects

hans hans@beehive.de
Wed, 27 Mar 2002 12:24:41 +0000


giere wrote:

> Hello!
> I just start off to work with DTML-stuff. I have a string like "a.b",
> created with
>
> <dtml-call
> "REQUEST.set('var1',_.string.replace(_['tree-item-url'],'/','.'))">
>
> I want to add a folder with
>
> <dtml-call "_['var1'].manage_addFolder('testfolder','TEST')">
>
> Is there a possibility to change the type from string to object?

Semms you already have an url (strings with slashes, tree-item-url).
In that case, you need the object of this url.

http://www.zope.org/Members/michel/ZB/AppendixB.dtml
module ObjectManagerItem
class ObjectManagerItem

tells:

restrictedTraverse(path, default=None)
Return the object obtained by traversing the given path from
        the object on which the method was called, performing security
        checks along the way.
If an object is not found then the default argument will be
        returned.
Permission
Always available

cheers hans
-------------------------------------------------------------
Who's got only a hammer sees the world as a nail
hans augustin  (software developer)           hans@beehive.de
beehive elektronische medien GmbH       http://www.beehive.de
phone: +49 30 847-82 0                  fax: +49 30 847-82 299