[Zope] question about manipulating zcatalog query results

Ira Sher invisibleira at gmail.com
Fri Apr 1 13:15:13 EST 2005


Chris, the relevant section of the script looks like this:

zcat=context.Catalog
if spontype == 'none':
	results = zcat(meta_type=mtype)
else:
	results = zcat(meta_type=mtype,SB_sponsor_type=spontype)
if sorton == 'id':
	res = []
	rest = []
	res = list(results)
	for row in res:
		rest.append(row.id.split().pop(), row)
rest.sort()
return rest

this keeps garnering the 'global name _getiter_ is not defined under
2.7.5'...as you can see, the results have been transfered to a new
list, so I'm not even looping and splitting the original query results
(this was originally a much briefer script, but I've broken it down to
see where exactly things were hanging up). If I pull the loop, or use
a while loop and simply asign values from res to rest, then everything
works fine, but as soon as I use that for loop, I get the _getiter_
error, and using split with the while loop (looks like:

j = 0
while j < len(res):
	k = res[j]
	kk = k.split().pop()
	rest.append(kk)
	j = j+1


) I get AttributeError: split, or in the case of trying to play with
the k string pulled from the list (by adding additional text, for
example) I get "Record objects do not support concatenation". I just
can't see a way to play with the zcat query results without raising an
error, and I'm dreadful confused...

thanks again for looking into this
ira

On Apr 1, 2005 12:24 AM, Chris Withers <chris at simplistix.co.uk> wrote:
> Ira Sher wrote:
> > There is no call to _getiter_, of course, in the script, but whenever
> > I use any for looping on the results, I get a variation of the above.
> >
> > Any thoughts on this?
> 
> Hmm, I should have asked this in the first place, but can you post the
> source code for your test python script?
> 
> cheers,
> 
> Chris
> 
> --
> Simplistix - Content Management, Zope & Python Consulting
>             - http://www.simplistix.co.uk
> 
>


More information about the Zope mailing list