[Zope] Re: access a subfolder in python

Maik Jablonski maik.jablonski@uni-bielefeld.de
Sun, 13 Oct 2002 14:04:44 +0200


Steffen Hausmann wrote:
> Hi,
> 
> I'm trying to create an object in a subfolder of an object.
> 
> If I use 'self.test._setObject(newUserProperty.id, newUserProperty)'
> where 'test' is the name of the subfolder it works perfect, but I want
> to change the name of the folder dynamically.
> 
> Therefor I need a variable, but if I replace test by a variable (name)
> I'm getting an Attribute Error.
> 
> Error Type: AttributeError
> Error Value: name
> 

hi steffen,

this should work for you:

objectId='test'
getattr(self,objectId)._setObject(...)

cheers, maik

-- 
Maik Jablonski                 __o
www.zfl.uni-bielefeld.de     _ \<_    Deutsche Zope User Group
Bielefeld, Germany          (_)/(_)               www.dzug.org