Commits

Robert Brewer committed 6fbc4c3

A couple of Python2.3 fixes.

Comments (0)

Files changed (2)

cherrypy/process/wspbus.py

         
         items = [(self._priorities[(channel, listener)], listener)
                  for listener in self.listeners[channel]]
-        by_priority = lambda item: item[0]
-        items.sort(key=by_priority)
+        try:
+            items.sort(key=lambda item: item[0])
+        except TypeError:
+            # Python 2.3 had no 'key' arg, but that doesn't matter
+            # since it could sort dissimilar types just fine.
+            items.sort()
         for priority, listener in items:
             try:
                 output.append(listener(*args, **kwargs))

cherrypy/test/webtest.py

                     
                     self._method = method
                     if not url:
-                        url = b'/'
-                    request = b' '.join((method.encode("ASCII"), url,
-                                         self._http_vsn_str.encode("ASCII")))
+                        url = ntob('/')
+                    request = ntob(' ').join((method.encode("ASCII"), url,
+                                              self._http_vsn_str.encode("ASCII")))
                     self._output(request)
                 import types
                 conn.putrequest = types.MethodType(putrequest, conn)