Don't change gramps_id if doesn't fit; removed to match gen/db/read.py

svn: r23312
This commit is contained in:
Doug Blank 2013-10-11 17:47:52 +00:00
parent 5545f37edc
commit 1a4445f576
2 changed files with 23 additions and 23 deletions

View File

@ -304,7 +304,7 @@ class DictionaryDb(DbWriteBase, DbReadBase):
format. format.
""" """
pattern_match = re.match(r"(.*)%[0 ](\d+)[diu]$", id_pattern) pattern_match = re.match(r"(.*)%[0 ](\d+)[diu]$", id_pattern)
if False: # pattern_match: if pattern_match:
str_prefix = pattern_match.group(1) str_prefix = pattern_match.group(1)
nr_width = int(pattern_match.group(2)) nr_width = int(pattern_match.group(2))
def closure_func(gramps_id): def closure_func(gramps_id):
@ -312,16 +312,16 @@ class DictionaryDb(DbWriteBase, DbReadBase):
id_number = gramps_id[len(str_prefix):] id_number = gramps_id[len(str_prefix):]
if id_number.isdigit(): if id_number.isdigit():
id_value = int(id_number, 10) id_value = int(id_number, 10)
if len(str(id_value)) > nr_width: #if len(str(id_value)) > nr_width:
# The ID to be imported is too large to fit in the # # The ID to be imported is too large to fit in the
# users format. For now just create a new ID, # # users format. For now just create a new ID,
# because that is also what happens with IDs that # # because that is also what happens with IDs that
# are identical to IDs already in the database. If # # are identical to IDs already in the database. If
# the problem of colliding import and already # # the problem of colliding import and already
# present IDs is solved the code here also needs # # present IDs is solved the code here also needs
# some solution. # # some solution.
gramps_id = id_pattern % 1 # gramps_id = id_pattern % 1
else: #else:
gramps_id = id_pattern % id_value gramps_id = id_pattern % id_value
return gramps_id return gramps_id
else: else:

View File

@ -376,16 +376,16 @@ class DbDjango(DbWriteBase, DbReadBase):
id_number = gramps_id[len(str_prefix):] id_number = gramps_id[len(str_prefix):]
if id_number.isdigit(): if id_number.isdigit():
id_value = int(id_number, 10) id_value = int(id_number, 10)
if len(str(id_value)) > nr_width: #if len(str(id_value)) > nr_width:
# The ID to be imported is too large to fit in the # # The ID to be imported is too large to fit in the
# users format. For now just create a new ID, # # users format. For now just create a new ID,
# because that is also what happens with IDs that # # because that is also what happens with IDs that
# are identical to IDs already in the database. If # # are identical to IDs already in the database. If
# the problem of colliding import and already # # the problem of colliding import and already
# present IDs is solved the code here also needs # # present IDs is solved the code here also needs
# some solution. # # some solution.
gramps_id = id_pattern % 1 # gramps_id = id_pattern % 1
else: #else:
gramps_id = id_pattern % id_value gramps_id = id_pattern % id_value
return gramps_id return gramps_id
else: else: