[Zope] Getting a specific object in Python from an id string (Was [Zope]: Python method for getting contents of a sub-folder)
complaw@hal-pc.org
complaw@hal-pc.org
Thu, 23 Aug 2001 00:23:44 GMT
> complaw@hal-pc.org writes:
> > ....
> If you mean with an "oid" an "id" as used by Zope as part
> of the URLs, then the answer is easy:
>
> getattr(container/context,id)
Okay, lets take an example where a lines property contains a list of id's (not
the objects themselves, simply a string representation of the id's). Then to
get the url and title properties of a given id in the lines property, could I
simply...
<dtml-in my_lines_property>
<dtml-with expr="getattr(container/context/_.getitem('sequence-item'),
absolute_url)">
<A HREF="<dtml-var absolute_url>">
</dtml-with>
<dtml-with expr="getattr(container/context/_.getitem('sequence-item'),
title)">
<dtml-var title></A><BR>
</dtml-with>
</dtml-in>
? Could it really be that easy?
Ron
>
> If you mean the object id as used inside the ZODB to identify
> an object, then you (probably) will need to use an external
> method.
>
>
> Dieter
>
> _______________________________________________
> 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 )
>