[Zope] Access Object 'by name' from python
Casey Duncan
cduncan@kaivo.com
Fri, 06 Jul 2001 10:37:15 -0600
Horst Wald wrote:
>
> Hi,
>
> is there a way to access Objects 'by name'? I mean to pass the name or the
> path of an object to a python script and then call it? Like the
> _[...] trick?
>
> By the way: via objectItems(), I can get a list like
>
> ['DB', 'DBAdapter', 'DBInterface', 'index_html', 'rename', 'kadabra',
> 'abra', 'LogBuch', 'LogNeu', 'delete', 'exists', 'ko', 'asas', 'copy_of_ko',
> 'listRec', 'listAll']
>
> of all the objects in a given folder. Is there a way to do that recursively?
>
> One last question: is there a way to see the type of a given object from
> python? Or to see if it has certain attributes?
>
> Thank you Gurus
>
> Horst
getattr(context, 'name')
Should do the trick.
--
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>