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

View File

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