[gen] Stop using param 'cmp' in method [].sort (deprecated in Python3). Used para 'key' instead.

This commit is contained in:
Gaetan Delannay 2013-01-22 09:12:00 +01:00
parent b3ff087e8f
commit cb77418dda
2 changed files with 3 additions and 4 deletions

View file

@ -177,9 +177,8 @@ class AbstractWrapper(object):
refs = getattr(self.o, fieldName, None)
if not refs: return
tool = self.tool
refs.sort(lambda x,y: cmp(getattr(tool.getObject(x), sortKey),
getattr(tool.getObject(y), sortKey)))
if reverse: refs.reverse()
refs.sort(key=lambda x: getattr(tool.getObject(x), sortKey),
reverse=reverse)
def create(self, fieldNameOrClass, noSecurity=False, **kwargs):
'''If p_fieldNameOrClass is the name of a field, this method allows to