[Zope] getting object reference from an id string?
Darran Edmundson
Darran.Edmundson@anu.edu.au
Wed, 8 Mar 2000 23:24:46 +1100
Say one has an object reference and knows the
string id of a child node. From this info, we
want an object reference to the named child.
I'd like someone to prove me wrong that there
is not a one-liner to accomplish this seemingly
trivial task. I've had to resort to (off the
top of my head) code like:
<dtml-in "objectValues(['child meta-type'])">
<dtml-with sequence-item>
<dtml-if "id == desired_id">
<dtml-call "REQUEST.set('desired_ref',_['sequence-item'])">
</dtml-if>
</dtml-with>
</dtml-in>
I'm really looking for a solution that doesn't
require looping. Since Zope enforces unique id's
at a given level, the name should be sufficient
to resolve the child object.
Darran.