git://git.onelab.eu
/
nepi.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Merge neco to nepi-3.0
[nepi.git]
/
src
/
nepi
/
util
/
guid.py
1
# FIXME: This class is not thread-safe.
2
# Should it be made thread-safe?
3
class GuidGenerator(object):
4
def __init__(self):
5
self._guids = list()
6
7
def next(self, guid = None):
8
if guid != None:
9
return guid
10
else:
11
last_guid = 0 if len(self._guids) == 0 else self._guids[-1]
12
guid = last_guid + 1
13
self._guids.append(guid)
14
self._guids.sort()
15
return guid
16