[Zope3-Users] Convert from string to class
Marc Rijken
marc at rijken.org
Tue Jan 17 17:26:00 EST 2006
Hi Florian,
This function will do the job:
def translateDottedName(i):
names = i.split('.')
module = __import__('.'.join(names[:-1]), {}, {}, ['*'])
return getattr(module, names[-1])
Marc
Florian Lindner wrote:
>Hello,
>I've a string like "zope.app.folder.Folder" and I want to get the class
>zope.app.folder.Folder from this string. How can I do that?
>It's probably more a python problem that Zope... but I hope you excuse.
>
>
>Thanks,
>
>Florian
>_______________________________________________
>Zope3-users mailing list
>Zope3-users at zope.org
>http://mail.zope.org/mailman/listinfo/zope3-users
>
>
>
More information about the Zope3-users
mailing list