Commit c3a7238f authored by Tres Seaver's avatar Tres Seaver

Merge branch 'master' of github.com:zopefoundation/ZEO

parents ad1aba0e 47cbb8d7
......@@ -46,11 +46,9 @@ from ZEO.Exceptions import AuthError
from ZEO.hash import sha1
def get_random_bytes(n=8):
if os.path.exists("/dev/urandom"):
f = open("/dev/urandom", 'rb')
b = f.read(n)
f.close()
else:
try:
b = os.urandom(n)
except NotImplementedError:
L = [chr(random.randint(0, 255)) for i in range(n)]
b = b"".join(L)
return b
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment