qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r1069752 - /qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/priority.py
Date Fri, 11 Feb 2011 11:21:31 GMT
Author: gsim
Date: Fri Feb 11 11:21:31 2011
New Revision: 1069752

URL: http://svn.apache.org/viewvc?rev=1069752&view=rev
Log:
QPID-529: Further adjustment for python 2.3

Modified:
    qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/priority.py

Modified: qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/priority.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/priority.py?rev=1069752&r1=1069751&r2=1069752&view=diff
==============================================================================
--- qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/priority.py (original)
+++ qpid/trunk/qpid/tests/src/py/qpid_tests/broker_0_10/priority.py Fri Feb 11 11:21:31 2011
@@ -222,14 +222,16 @@ def priority_level(value, levels):
 
 def sorted_(msgs, key=None, reverse=False):
     """
-    Workaround lack of sorted builtin function in python 2.3
+    Workaround lack of sorted builtin function in python 2.3 and lack
+    of keyword arguments to list.sort()
     """
     temp = msgs
-    temp.sort(cmp=key_to_cmp(key), reverse=reverse)
+    temp.sort(key_to_cmp(key, reverse=reverse))
     return temp
 
-def key_to_cmp(key):
+def key_to_cmp(key, reverse=False):
     if key:
-        return lambda a, b: cmp(key(a), key(b))
+        if reverse: return lambda a, b: cmp(key(b), key(a))
+        else: return lambda a, b: cmp(key(a), key(b))  
     else:
         return None



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message