[Zope] Variable interpolation / string embedding in Python script?

Chris Withers chrisw@nipltd.com
Wed, 26 Feb 2003 09:51:53 +0000


Jon Whitener wrote:
> In Zope Page Templates, you can insert a variable into a path expression 
> like:
> 
>   here/folder/?id
> 
> Where 'id' is evaluated before the path expression is.  It's great for 
> repeat structures.  Is there a similar mechanism for use in a Python 
> Script?  Something like
> 
>   context.?id.method()

Hehe, you want:

getattr(context,id).method()

cheers,

Chris