[Zope] convert a String ...
Hi, how is it possible to convert a string into my own zclass type? I get a String from a form and want to do some operation like string.manage_addFile(... on it. So what to do ??? Perhaps some out there is able to help ... Thanks, Marc ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] convert a String ...
To "convert" a string to an object, you use the getitem() function. ## example 1: Your: dtml-var last_name #returns: Your: Peter Bengtsson ## example 2: dtml-call "REQUEST.set('var_to_go_and_get','last_name')" Your: dtml-var "_.getitem(var_to_go_and_get)" # returns: Your: Peter Bengtsson There's more You could also do this: dtml-var "_[var_to_go_and_get]" or dtml-var "_['last_name']" The different between _['foo'] and _.getitem('foo') is tricky. Check out (somewhere in the middle): http://www.zope.org/Documentation/How-To/AdvancedDTML Hi, how is it possible to convert a string into my own zclass type? I get a String from a form and want to do some operation like string.manage_addFile(... on it. So what to do ??? Perhaps some out there is able to help ... Thanks, Marc ___ Zope maillist - [EMAIL PROTECTED] 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 ) ___ Zope maillist - [EMAIL PROTECTED] 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 )
Re: [Zope] convert a String ...
Marc Fischer writes: how is it possible to convert a string into my own zclass type? I get a String from a form and want to do some operation like string.manage_addFile(... on it. So what to do ??? Perhaps some out there is able to help ... "_.getitem(string)" converts a string into an object. Probably, you will not get a "zclass type". But such a type would probably not have a "manage_addFile" method anyway. Do you mean "Z Instance" rather than "zclass type"? Dieter ___ Zope maillist - [EMAIL PROTECTED] 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 )