Commit 57fadf09 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Move UUID generator into a method (will be used by election.py)


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@415 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent dd1ad716
......@@ -69,11 +69,7 @@ class Application(object):
# XXX Generate an UUID for self. For now, just use a random string.
# Avoid an invalid UUID.
while 1:
uuid = os.urandom(16)
if uuid != INVALID_UUID:
break
self.uuid = uuid
self.uuid = self.getNewUUID()
# The last OID.
self.loid = INVALID_OID
......@@ -786,3 +782,9 @@ class Application(object):
def getNewOIDList(self, num_oids):
return [self.getNextOID() for i in xrange(num_oids)]
def getNewUUID(self):
uuid = INVALID_UUID
while uuid == INVALID_UUID:
uuid = os.urandom(16)
return uuid
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