Re: [Zope] python script syntax

2007-02-14 Thread Paul Winkler
On Wed, Feb 14, 2007 at 11:42:59PM +, garry saddington wrote:
 I want to do something like this in a script:
 
 forms='7L'
 
 context.forms.manage_addFolder('filey')
 
 ie. substitute the variable 'forms' for the correct value but I can not
 get the syntax correct, can anyone help?

Look up getattr() in Python's documentation.


-- 

Paul Winkler
http://www.slinkp.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] python script syntax

2007-02-14 Thread Peter Bengtsson

On 2/14/07, garry saddington [EMAIL PROTECTED] wrote:

I want to do something like this in a script:

forms='7L'


getattr(context, forms).manage_addFolder('filey')

PS. This getattr() is actually not the same as the Python getattr()
belive it or not. It just has the same name and pretty much similar
functionality.


context.forms.manage_addFolder('filey')

ie. substitute the variable 'forms' for the correct value but I can not
get the syntax correct, can anyone help?
regards
garry

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )




--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )