[Zope] Sequence sorting module from a Python script
Leticia Larrosa
LETICIA at tesla.cujae.edu.cu
Sun Apr 24 17:13:37 EDT 2005
Hi all:
I want to order a sequence using the Sequence sorting module from a Python
script.
I have the following code:
"
seq = [['Bruzon', 'CUB'], ['Anand', 'IND'], ['Kasparov', 'RUS']]
def test(oneElem, twoElem):
if oneElem[0] == twoElem[0]:
return 0
if oneElem[0] > twoElem[0]:
return 1
else:
return -1
sort_on =(('self', test, 'desc'))
return sequence.sort(seq, sort_on)
"
and i get the error:
"
Error Type: SyntaxError
Error Value: sort option must contains no more than 2 fields
"
the Traceback:
"
Traceback (innermost last):
Module ZPublisher.Publish, line 101, in publish
Module ZPublisher.mapply, line 88, in mapply
Module ZPublisher.Publish, line 39, in call_object
Module Shared.DC.Scripts.Bindings, line 306, in __call__
Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
Module Products.PythonScripts.PythonScript, line 323, in _exec
Module None, line 22, in orderBy
<PythonScript at /approach/SiccApproach/adminInformation/orderBy>
Line 22
Module DocumentTemplate.sequence.SortEx, line 66, in sort
Module DocumentTemplate.sequence.SortEx, line 161, in make_sortfunctions
SyntaxError: sort option must contains no more than 2 fields
"
what i'm doing wrong?
Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20050424/8c526702/attachment.htm
More information about the Zope
mailing list