New constant for UUID creations

svn: r13538
This commit is contained in:
Doug Blank 2009-11-10 03:33:10 +00:00
parent 14cbb9e27a
commit 17d709be14
2 changed files with 10 additions and 2 deletions

View File

@ -37,6 +37,7 @@ import random
import time
import shutil
import platform
import uuid
#-------------------------------------------------------------------------
#
@ -48,7 +49,7 @@ import gen.lib
import Errors
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 _
#-------------------------------------------------------------------------
@ -444,6 +445,13 @@ def create_id():
return "%08x%08x" % ( int(time.time()*10000),
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

View File

@ -261,4 +261,4 @@ LONGOPTS = [
SHORTOPTS = "O:i:e:f:a:p:d:lLhu?"
GRAMPS_UUID = uuid.UUID('516cd010-5a41-470f-99f8-eb22f1098ad6')