From 5a0ebb7d8c36efec5dcc2c9182cfc9056993f0dd Mon Sep 17 00:00:00 2001 From: mdipierro Date: Sun, 14 Oct 2012 14:16:43 -0500 Subject: [PATCH] faster better web2py_uuid, thanks Michele --- VERSION | 2 +- gluon/utils.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 35d8d2f4..15e51e7f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.1.0 (2012-10-13 14:36:14) dev +Version 2.1.0 (2012-10-14 14:16:37) dev diff --git a/gluon/utils.py b/gluon/utils.py index e10fb7a4..13314c5e 100644 --- a/gluon/utils.py +++ b/gluon/utils.py @@ -161,8 +161,7 @@ def web2py_uuid(ctokens=UNPACKED_CTOKENS): It works like uuid.uuid4 except that tries to use os.urandom() if possible and it XORs the output with the tokens uniquely associated with this machine. """ - rand_longs = struct.unpack('=QQ', string.join( - (chr(random.randrange(256)) for i in xrange(16)),'')) + rand_longs = (random.getrandbits(64),random.getrandbits(64)) if HAVE_URANDOM: urand_longs = struct.unpack('=QQ', fast_urandom16()) byte_s = struct.pack('=QQ',