getting object reference from an id string?
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.
On Wed, 8 Mar 2000, Darran Edmundson wrote:
<dtml-if "id == desired_id">
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.
May be, resolve_url? Oleg. ---- Oleg Broytmann Foundation for Effective Policies phd@phd.russ.ru Programmers don't die, they just GOSUB without RETURN.
participants (2)
-
Darran Edmundson -
Oleg Broytmann