New constant for UUID creations
svn: r13538
This commit is contained in:
parent
14cbb9e27a
commit
17d709be14
10
src/Utils.py
10
src/Utils.py
@ -37,6 +37,7 @@ import random
|
|||||||
import time
|
import time
|
||||||
import shutil
|
import shutil
|
||||||
import platform
|
import platform
|
||||||
|
import uuid
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -48,7 +49,7 @@ import gen.lib
|
|||||||
import Errors
|
import Errors
|
||||||
from GrampsLocale import codeset
|
from GrampsLocale import codeset
|
||||||
|
|
||||||
from const import TEMP_DIR, USER_HOME, WINDOWS, MACOS, LINUX
|
from const import TEMP_DIR, USER_HOME, WINDOWS, MACOS, LINUX, GRAMPS_UUID
|
||||||
from TransUtils import sgettext as _
|
from TransUtils import sgettext as _
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -444,6 +445,13 @@ def create_id():
|
|||||||
return "%08x%08x" % ( int(time.time()*10000),
|
return "%08x%08x" % ( int(time.time()*10000),
|
||||||
rand.randint(0, sys.maxint))
|
rand.randint(0, sys.maxint))
|
||||||
|
|
||||||
|
def create_uid(self, handle=None):
|
||||||
|
if handle:
|
||||||
|
uid = uuid.uuid5(GRAMPS_UUID, handle)
|
||||||
|
else:
|
||||||
|
uid = uuid.uuid4()
|
||||||
|
return uid.hex.upper()
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# probably_alive
|
# probably_alive
|
||||||
|
@ -261,4 +261,4 @@ LONGOPTS = [
|
|||||||
|
|
||||||
SHORTOPTS = "O:i:e:f:a:p:d:lLhu?"
|
SHORTOPTS = "O:i:e:f:a:p:d:lLhu?"
|
||||||
|
|
||||||
|
GRAMPS_UUID = uuid.UUID('516cd010-5a41-470f-99f8-eb22f1098ad6')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user