[Zope] sort in python script dynamically?

Paul Winkler pw_lists at slinkp.com
Fri Jan 9 10:59:43 EST 2004


On Fri, Jan 09, 2004 at 09:33:42AM +0100, Jaroslav Lukesh wrote:
> I was try before:
> 
> ids = self.objectIds('Folder')
> ids = ids.sort()
> for i in ids :
> 
> TypeError: object of type 'string' is not callable
> 
> Regards, JL.

two points:

1) "self" has meaning in Product code and in External Methods,
but not Script (Python). Which are you writing?
(I doubt that's the problem because if it was, it wouldn't give
a TypeError, it should give a NameError)

2) Your example looks fine except that it's incomplete.
What's after "for i in ids:"?  
If you try to call i(), you will get that error :-)

foo.objectIds() returns a list of strings.
foo.objectValues() returns a lit of zope objects.
foo.objectItems() returns a list of (id, object) pairs.

-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's WALRUS HYDRO WEASLE-CAKE !
(random hero from isometric.spaceninja.com)



More information about the Zope mailing list