[rhmessaging-commits] rhmessaging commits: r3745 - mgmt/trunk/wooly/python/wooly.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Wed Dec 16 11:19:01 EST 2009


Author: justi9
Date: 2009-12-16 11:19:00 -0500 (Wed, 16 Dec 2009)
New Revision: 3745

Modified:
   mgmt/trunk/wooly/python/wooly/__init__.py
   mgmt/trunk/wooly/python/wooly/server.py
   mgmt/trunk/wooly/python/wooly/util.py
Log:
Use a custom unique id function, since uuid4 is not available in python 2.4

Modified: mgmt/trunk/wooly/python/wooly/__init__.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/__init__.py	2009-12-15 18:35:00 UTC (rev 3744)
+++ mgmt/trunk/wooly/python/wooly/__init__.py	2009-12-16 16:19:00 UTC (rev 3745)
@@ -8,7 +8,6 @@
 from copy import copy
 from urlparse import urlsplit
 from time import gmtime
-from uuid import uuid4
 
 from wooly.profile import *
 from resources import ResourceFinder, StringCatalog
@@ -694,7 +693,7 @@
 
 class ClientSession(object):
     def __init__(self):
-        self.id = str(uuid4())
+        self.id = unique_id()
         self.created = datetime.now()
         self.visited = None
 

Modified: mgmt/trunk/wooly/python/wooly/server.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/server.py	2009-12-15 18:35:00 UTC (rev 3744)
+++ mgmt/trunk/wooly/python/wooly/server.py	2009-12-16 16:19:00 UTC (rev 3745)
@@ -2,8 +2,6 @@
 from datetime import datetime, timedelta
 from threading import Thread
 from time import strptime
-from uuid import uuid4
-from base64 import decodestring
 from parsley.threadingex import Lifecycle
 from wooly import *
 

Modified: mgmt/trunk/wooly/python/wooly/util.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/util.py	2009-12-15 18:35:00 UTC (rev 3744)
+++ mgmt/trunk/wooly/python/wooly/util.py	2009-12-16 16:19:00 UTC (rev 3745)
@@ -1,4 +1,13 @@
 import logging
+import random
 
 from datetime import datetime
 from time import clock
+
+def unique_id():
+    bits0 = random.getrandbits(32)
+    bits1 = random.getrandbits(32)
+    bits2 = random.getrandbits(32)
+    bits3 = random.getrandbits(32)
+
+    return "%08x-%08x-%08x-%08x" % (bits0, bits1, bits2, bits3)



More information about the rhmessaging-commits mailing list