[Zope] sort with external comparison function

Dennis Allison allison@sumeru.stanford.EDU
Sun, 1 Sep 2002 13:16:15 -0700


I have a problem with sorting in a <dtml-in> which may be a bug
or just a conctptual error.  Suppose foo is a simple sequence
and myCompare is a two-parameter Python script returning 
-1, 0, 1.  The the dtml snippet

<dtml-in foo sort="sequence-item/myCompoare">
   <dtml-var sequence-item>
</dtml-in>

should render the sequence in my sort order but does not.  It does call
the myCompare routine (a Python Script in the Zope space).

The problem seems to be with the parameterization.  The version of
myCompare I am trying to use generates an error because the parametrs
seem not to be set.  If I change myCompare to be

def myCompare( a,b):
	return cmp( a, b )

it should be the equivalent of the default sort--but it's not.