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? Kind regards, Philipp
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
Thanks a lot Hans! This worked fine inside the with -Tag Philipp hans schrieb:
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
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (2)
-
giere -
hans