Commit 48af274b authored by Vincent Pelletier's avatar Vincent Pelletier

Use "global" keywords instead of doing globals() magic.

Add an XXX about a duplaicate function definition in the same file.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1159 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent f4d44526
...@@ -333,16 +333,18 @@ class NeoTestBase(unittest.TestCase): ...@@ -333,16 +333,18 @@ class NeoTestBase(unittest.TestCase):
connector_cpt = 0 connector_cpt = 0
# XXX This function is specific to a primary master test, I think.
# It should not be here (as it shadows a more generic getNewUUID above).
# master node with the highest uuid will be declared as PMN # master node with the highest uuid will be declared as PMN
previous_uuid = None previous_uuid = None
def getNewUUID(): def getNewUUID():
global previous_uuid
uuid = protocol.INVALID_UUID uuid = protocol.INVALID_UUID
previous = globals()["previous_uuid"] while uuid == protocol.INVALID_UUID or (previous_uuid is \
while uuid == protocol.INVALID_UUID or (previous is \ not None and uuid > previous_uuid):
not None and uuid > previous):
uuid = os.urandom(16) uuid = os.urandom(16)
logging.info("previous > uuid %s"%(previous > uuid)) logging.info("previous_uuid > uuid %s"%(previous_uuid > uuid))
globals()["previous_uuid"] = uuid previous_uuid = uuid
return uuid return uuid
class DoNothingConnector(Mock): class DoNothingConnector(Mock):
......
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