1 """module to build GUIDs"""
2
3
4 import time
5 import random
6
7
8
9 try:
10 import uuid as uuid_module
12 return str(uuid_module.uuid4())
13 except ImportError:
14
16 """Poor's man uuid. This is a stub provided by Ganga to
17 complement missing functionality in python<2.5"""
18 return (str(random.uniform(0,100000000))+'-'+str(time.time())).replace('.','-')
19
20
21
22
23
24
26 """newGUID(value = None) --> guid
27 value - any python object"""
28 tt = time.gmtime()[0:6] + (random.randint(0,9),
29 random.randint(0,9),
30 random.randint(0,9),
31 id(value))
32 return '_' + (''.join(map(str, tt))).replace('-','')
33