[Zope] Getting an object from it's id
Geoff Armstrong
geofstro@monaco.mc
Tue, 23 Jan 2001 14:05:54 +0000
on 1/23/01 1:12 PM, Erik Enge at erik+list@esol.no wrote:
Thanks; but being new to this could you help me a bit more by providing an
example of how to use 'getOb' within <dtml code. I tried testing in; but
couldn't get it work.
Geoff
> [geofstro@monaco.mc]
>
> | Is there a Zope API method that will allow me to get an object from
> | it's id, or can I write a simple Python method to do it, or am I
> | missing something even more obvious?
>
> Well, sometimes objectItems or objectValues can be the right ones to
> use. Other times, (in Python Products at least) you use _getOb() to
> fetch the object for you.
>
> Let's say you have this object structure:
>
> /Folder1
> /Folder2
>
> If you (in Python code) have Folder1 in the namespace, as self for
> example, you can say object=self._getOb('Folder2'), and ṿila. :)
> Don't know how you would do that in DTML, though.
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )