[Zope] Getting the position of an object in a folder

Janko Hauser jh@comunit.de
Tue, 27 Aug 2002 14:09:38 +0200


Maik Jablonski wrote:
> 
> Pierre Godefroy wrote:
> 
>> Is there a simple and direct way to get the position of an object in a 
>> parent folder without iterating with a dtml-in loop through all the 
>> objects of the folder and countring until one gets to the id of the 
>> said object?
>>
> 
> a little python-script should do this trick for you:
> 
> return context.objectIds().index('standard_html_header')
> 

Beware that this is not guaranteed to result always the same index, as
objectIds is something like  dict.keys(). The order of the elements in a 
mapping
is not fixed.

HTH,
__Janko