Commits

Robert Brewer committed ae1b2e3

A couple more Python 2.3 fixes.

  • Participants
  • Parent commits 4628802

Comments (0)

Files changed (2)

File cherrypy/_cpcompat.py

 import binascii
 try:
     os.urandom(20)
+    def random20():
+        return binascii.hexlify(os.urandom(20)).decode('ascii')
 except (AttributeError, NotImplementedError):
+    import random
     # os.urandom not available until Python 2.4. Fall back to random.random.
     def random20():
-        return binascii.hexlify(sha(random.random())).decode('ascii')
-else:
-    def random20():
-        return binascii.hexlify(os.urandom(20)).decode('ascii')
+        return sha('%s' % random.random()).hexdigest()
 
 try:
     from _thread import get_ident as get_thread_ident

File cherrypy/test/test_json.py

     
     def test_json_output(self):
         if json is None:
-            self.skip("json not found")
+            self.skip("json not found ")
+            return
         
         self.getPage("/plain")
         self.assertBody("hello")
 
     def test_json_input(self):
         if json is None:
-            self.skip("json not found")
+            self.skip("json not found ")
+            return
         
         body = '[13, "c"]'
         headers = [('Content-Type', 'application/json'),