0005785: print statements in Check.py causing a crash in Windows (pythonw.exe) after outputting 4096 characters. Change to logging.warning and logging.info.
svn: r19993
This commit is contained in:
parent
e8a8c866f2
commit
df36baafc8
@ -48,7 +48,6 @@ from collections import defaultdict
|
|||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import logging
|
import logging
|
||||||
LOG_OBJ = logging.getLogger(".CheckRepair")
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -78,10 +77,6 @@ from glade import Glade
|
|||||||
# All except 09, 0A, 0D are replaced with space.
|
# All except 09, 0A, 0D are replaced with space.
|
||||||
strip_dict = dict.fromkeys(range(9)+range(11,13)+range(14, 32), u" ")
|
strip_dict = dict.fromkeys(range(9)+range(11,13)+range(14, 32), u" ")
|
||||||
|
|
||||||
# This is assigned so that it can be either LOG_OBJ.debug or print, depending on
|
|
||||||
# which is deemed to better interface for Gramps
|
|
||||||
LOG = print
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Low Level repair
|
# Low Level repair
|
||||||
@ -101,7 +96,7 @@ def cross_table_duplicates(db):
|
|||||||
"""
|
"""
|
||||||
progress = ProgressMeter(_('Checking Database'),'')
|
progress = ProgressMeter(_('Checking Database'),'')
|
||||||
progress.set_pass(_('Looking for cross table duplicates'), 9)
|
progress.set_pass(_('Looking for cross table duplicates'), 9)
|
||||||
LOG('Looking for cross table duplicates')
|
logging.info('Looking for cross table duplicates')
|
||||||
total_nr_handles = 0
|
total_nr_handles = 0
|
||||||
all_handles = set([])
|
all_handles = set([])
|
||||||
for the_map in [db.person_map, db.family_map, db.event_map, db.place_map,
|
for the_map in [db.person_map, db.family_map, db.event_map, db.place_map,
|
||||||
@ -113,8 +108,11 @@ def cross_table_duplicates(db):
|
|||||||
progress.step()
|
progress.step()
|
||||||
progress.close()
|
progress.close()
|
||||||
num_errors = total_nr_handles - len(all_handles)
|
num_errors = total_nr_handles - len(all_handles)
|
||||||
LOG(' OK: No cross table duplicates' if num_errors == 0 else
|
if num_errors == 0:
|
||||||
' FAIL: Found %d cross table duplicates' % num_errors)
|
logging.info(' OK: No cross table duplicates')
|
||||||
|
else:
|
||||||
|
logging.warning(' FAIL: Found %d cross table duplicates' %
|
||||||
|
num_errors)
|
||||||
return total_nr_handles > len(all_handles)
|
return total_nr_handles > len(all_handles)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -251,7 +249,7 @@ class CheckIntegrity(object):
|
|||||||
"""
|
"""
|
||||||
self.progress.set_pass(_('Looking for invalid name format references'),
|
self.progress.set_pass(_('Looking for invalid name format references'),
|
||||||
self.db.get_number_of_people())
|
self.db.get_number_of_people())
|
||||||
LOG('Looking for invalid name format references')
|
logging.info('Looking for invalid name format references')
|
||||||
|
|
||||||
deleted_name_formats = [number for (number, name, fmt_str,act)
|
deleted_name_formats = [number for (number, name, fmt_str,act)
|
||||||
in self.db.name_formats if not act]
|
in self.db.name_formats if not act]
|
||||||
@ -297,13 +295,13 @@ class CheckIntegrity(object):
|
|||||||
only_active=False)
|
only_active=False)
|
||||||
|
|
||||||
if len(self.removed_name_format) == 0:
|
if len(self.removed_name_format) == 0:
|
||||||
LOG(' OK: no invalid name formats found found')
|
logging.info(' OK: no invalid name formats found found')
|
||||||
|
|
||||||
def cleanup_duplicate_spouses(self):
|
def cleanup_duplicate_spouses(self):
|
||||||
|
|
||||||
self.progress.set_pass(_('Looking for duplicate spouses'),
|
self.progress.set_pass(_('Looking for duplicate spouses'),
|
||||||
self.db.get_number_of_people())
|
self.db.get_number_of_people())
|
||||||
LOG('Looking for duplicate spouses')
|
logging.info('Looking for duplicate spouses')
|
||||||
previous_errors = len(self.duplicate_links)
|
previous_errors = len(self.duplicate_links)
|
||||||
|
|
||||||
for handle in self.db.person_map.keys():
|
for handle in self.db.person_map.keys():
|
||||||
@ -321,12 +319,12 @@ class CheckIntegrity(object):
|
|||||||
self.progress.step()
|
self.progress.step()
|
||||||
|
|
||||||
if previous_errors == len(self.duplicate_links):
|
if previous_errors == len(self.duplicate_links):
|
||||||
LOG(' OK: no duplicate spouses found')
|
logging.info(' OK: no duplicate spouses found')
|
||||||
|
|
||||||
def fix_encoding(self):
|
def fix_encoding(self):
|
||||||
self.progress.set_pass(_('Looking for character encoding errors'),
|
self.progress.set_pass(_('Looking for character encoding errors'),
|
||||||
self.db.get_number_of_media_objects())
|
self.db.get_number_of_media_objects())
|
||||||
LOG('Looking for character encoding errors')
|
logging.info('Looking for character encoding errors')
|
||||||
error_count = 0
|
error_count = 0
|
||||||
for handle in self.db.media_map.keys():
|
for handle in self.db.media_map.keys():
|
||||||
data = self.db.media_map[handle]
|
data = self.db.media_map[handle]
|
||||||
@ -336,11 +334,13 @@ class CheckIntegrity(object):
|
|||||||
obj.desc = Utils.fix_encoding( obj.desc, errors='ignore')
|
obj.desc = Utils.fix_encoding( obj.desc, errors='ignore')
|
||||||
self.db.commit_media_object(obj, self.trans)
|
self.db.commit_media_object(obj, self.trans)
|
||||||
if not isinstance(data[2], unicode):
|
if not isinstance(data[2], unicode):
|
||||||
LOG(' FAIL: encoding error on media object "%s"'
|
logging.warning(' FAIL: encoding error on media object '
|
||||||
' path "%s"' % (obj.gramps_id, obj.path))
|
'"%(gid)s" path "%(path)s"' %
|
||||||
|
{'gid' : obj.gramps_id, 'path' : obj.path})
|
||||||
if not isinstance(data[2], unicode):
|
if not isinstance(data[2], unicode):
|
||||||
LOG(' FAIL: encoding error on media object "%s"'
|
logging.warning(' FAIL: encoding error on media object '
|
||||||
' description "%s"' % (obj.gramps_id, obj.desc))
|
'"%(gid)s" description "%(desc)s"' %
|
||||||
|
{'gid' : obj.gramps_id, 'desc' : obj.desc})
|
||||||
error_count += 1
|
error_count += 1
|
||||||
# Once we are here, fix the mime string if not str
|
# Once we are here, fix the mime string if not str
|
||||||
if not isinstance(data[3], str):
|
if not isinstance(data[3], str):
|
||||||
@ -353,17 +353,18 @@ class CheckIntegrity(object):
|
|||||||
except:
|
except:
|
||||||
obj.mime = ""
|
obj.mime = ""
|
||||||
self.db.commit_media_object(obj, self.trans)
|
self.db.commit_media_object(obj, self.trans)
|
||||||
LOG(' FAIL: encoding error on media object "%s"'
|
logging.warning(' FAIL: encoding error on media object '
|
||||||
' mime "%s"' % (obj.desc, obj.mime))
|
'"%(desc)s" mime "%(mime)s"' %
|
||||||
|
{'desc' : obj.desc, 'mime' : obj.mime})
|
||||||
error_count += 1
|
error_count += 1
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
if error_count == 0:
|
if error_count == 0:
|
||||||
LOG(' OK: no encoding errors found')
|
logging.info(' OK: no encoding errors found')
|
||||||
|
|
||||||
def fix_ctrlchars_in_notes(self):
|
def fix_ctrlchars_in_notes(self):
|
||||||
self.progress.set_pass(_('Looking for ctrl characters in notes'),
|
self.progress.set_pass(_('Looking for ctrl characters in notes'),
|
||||||
self.db.get_number_of_notes())
|
self.db.get_number_of_notes())
|
||||||
LOG('Looking for ctrl characters in notes')
|
logging.info('Looking for ctrl characters in notes')
|
||||||
error_count = 0
|
error_count = 0
|
||||||
for handle in self.db.note_map.keys():
|
for handle in self.db.note_map.keys():
|
||||||
note = self.db.get_note_from_handle(handle)
|
note = self.db.get_note_from_handle(handle)
|
||||||
@ -371,7 +372,7 @@ class CheckIntegrity(object):
|
|||||||
old_text = unicode(stext)
|
old_text = unicode(stext)
|
||||||
new_text = old_text.translate(strip_dict)
|
new_text = old_text.translate(strip_dict)
|
||||||
if old_text != new_text:
|
if old_text != new_text:
|
||||||
LOG(' FAIL: control characters found in note "%s"' %
|
logging.warning(' FAIL: control characters found in note "%s"' %
|
||||||
self.db.note_map[handle][1])
|
self.db.note_map[handle][1])
|
||||||
error_count += 1
|
error_count += 1
|
||||||
# Commit only if ctrl char found.
|
# Commit only if ctrl char found.
|
||||||
@ -380,7 +381,7 @@ class CheckIntegrity(object):
|
|||||||
self.db.commit_note(note, self.trans)
|
self.db.commit_note(note, self.trans)
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
if error_count == 0:
|
if error_count == 0:
|
||||||
LOG(' OK: no ctrl characters in notes found')
|
logging.info(' OK: no ctrl characters in notes found')
|
||||||
|
|
||||||
def check_for_broken_family_links(self):
|
def check_for_broken_family_links(self):
|
||||||
# Check persons referenced by the family objects
|
# Check persons referenced by the family objects
|
||||||
@ -389,7 +390,7 @@ class CheckIntegrity(object):
|
|||||||
self.progress.set_pass(_('Looking for broken family links'),
|
self.progress.set_pass(_('Looking for broken family links'),
|
||||||
len(fhandle_list) +
|
len(fhandle_list) +
|
||||||
self.db.get_number_of_people())
|
self.db.get_number_of_people())
|
||||||
LOG('Looking for broken family links')
|
logging.info('Looking for broken family links')
|
||||||
previous_errors = len(self.broken_parent_links + self.broken_links)
|
previous_errors = len(self.broken_parent_links + self.broken_links)
|
||||||
|
|
||||||
for family_handle in fhandle_list:
|
for family_handle in fhandle_list:
|
||||||
@ -406,8 +407,10 @@ class CheckIntegrity(object):
|
|||||||
family.set_father_handle(None)
|
family.set_father_handle(None)
|
||||||
self.db.commit_family(family, self.trans)
|
self.db.commit_family(family, self.trans)
|
||||||
self.broken_parent_links.append((father_handle, family_handle))
|
self.broken_parent_links.append((father_handle, family_handle))
|
||||||
LOG(" FAIL: family '%s' father handle '%s'"
|
logging.warning(" FAIL: family '%(fam_gid)s' "
|
||||||
" does not exist" % (family.gramps_id, father_handle))
|
"father handle '%(hand)s' does not exist" %
|
||||||
|
{'fam_gid' : family.gramps_id,
|
||||||
|
'hand' : father_handle})
|
||||||
father_handle = None
|
father_handle = None
|
||||||
if mother_handle:
|
if mother_handle:
|
||||||
mother = self.db.get_person_from_handle(mother_handle)
|
mother = self.db.get_person_from_handle(mother_handle)
|
||||||
@ -419,8 +422,10 @@ class CheckIntegrity(object):
|
|||||||
family.set_mother_handle(None)
|
family.set_mother_handle(None)
|
||||||
self.db.commit_family(family, self.trans)
|
self.db.commit_family(family, self.trans)
|
||||||
self.broken_parent_links.append((mother_handle, family_handle))
|
self.broken_parent_links.append((mother_handle, family_handle))
|
||||||
LOG(" FAIL: family '%s' mother handle '%s'"
|
logging.warning(" FAIL: family '%(fam_gid)s' "
|
||||||
" does not exist" % (family.gramps_id, mother_handle))
|
"mother handle '%(hand)s' does not exist" %
|
||||||
|
{'fam_gid' : family.gramps_id,
|
||||||
|
'hand' : mother_handle})
|
||||||
mother_handle = None
|
mother_handle = None
|
||||||
|
|
||||||
if father_handle and father and \
|
if father_handle and father and \
|
||||||
@ -431,9 +436,10 @@ class CheckIntegrity(object):
|
|||||||
self.broken_parent_links.append((father_handle, family_handle))
|
self.broken_parent_links.append((father_handle, family_handle))
|
||||||
father.add_family_handle(family_handle)
|
father.add_family_handle(family_handle)
|
||||||
self.db.commit_person(father, self.trans)
|
self.db.commit_person(father, self.trans)
|
||||||
LOG(" FAIL: family '%s' father '%s'"
|
logging.warning(" FAIL: family '%(fam_gid)s' father "
|
||||||
" does not refer back to the family" %
|
"'%(hand)s' does not refer back to the family" %
|
||||||
(family.gramps_id, father_handle))
|
{'fam_gid' : family.gramps_id,
|
||||||
|
'hand' : father_handle})
|
||||||
|
|
||||||
if mother_handle and mother and \
|
if mother_handle and mother and \
|
||||||
family_handle not in mother.get_family_handle_list():
|
family_handle not in mother.get_family_handle_list():
|
||||||
@ -443,9 +449,10 @@ class CheckIntegrity(object):
|
|||||||
self.broken_parent_links.append((mother_handle, family_handle))
|
self.broken_parent_links.append((mother_handle, family_handle))
|
||||||
mother.add_family_handle(family_handle)
|
mother.add_family_handle(family_handle)
|
||||||
self.db.commit_person(mother, self.trans)
|
self.db.commit_person(mother, self.trans)
|
||||||
LOG(" FAIL: family '%s' mother '%s'"
|
logging.warning(" FAIL: family '%(fam_gid)s' mother "
|
||||||
" does not refer back to the family" %
|
"'%(hand)s' does not refer back to the family" %
|
||||||
(family.gramps_id, mother_handle))
|
{'fam_gid' : family.gramps_id,
|
||||||
|
'hand' : mother_handle})
|
||||||
|
|
||||||
for child_ref in family.get_child_ref_list():
|
for child_ref in family.get_child_ref_list():
|
||||||
child_handle = child_ref.ref
|
child_handle = child_ref.ref
|
||||||
@ -456,9 +463,11 @@ class CheckIntegrity(object):
|
|||||||
# such child from the family
|
# such child from the family
|
||||||
# This is tested by TestcaseGenerator where the father
|
# This is tested by TestcaseGenerator where the father
|
||||||
# is "Broken19"
|
# is "Broken19"
|
||||||
LOG(" FAIL: family '%s' child '%s'"
|
logging.warning(" FAIL: family '%(fam_gid)s' "
|
||||||
" is one of the parents" %
|
"child '%(child_gid)s' is one of the "
|
||||||
(family.gramps_id, child.gramps_id))
|
"parents" %
|
||||||
|
{'fam_gid' : family.gramps_id,
|
||||||
|
'child_gid' : child.gramps_id})
|
||||||
family.remove_child_ref(child_ref)
|
family.remove_child_ref(child_ref)
|
||||||
self.db.commit_family(family, self.trans)
|
self.db.commit_family(family, self.trans)
|
||||||
self.broken_links.append((child_handle, family_handle))
|
self.broken_links.append((child_handle, family_handle))
|
||||||
@ -470,9 +479,11 @@ class CheckIntegrity(object):
|
|||||||
# The referenced child has no reference to the family
|
# The referenced child has no reference to the family
|
||||||
# This is tested by TestcaseGenerator where the father
|
# This is tested by TestcaseGenerator where the father
|
||||||
# is "Broken8"
|
# is "Broken8"
|
||||||
LOG(" FAIL: family '%s' child '%s'"
|
logging.warning(" FAIL: family '%(fam_gid)s' "
|
||||||
" has no reference to the family" %
|
"child '%(child_gid)s' has no reference"
|
||||||
(family.gramps_id, child.gramps_id))
|
" to the family" %
|
||||||
|
{'fam_gid' : family.gramps_id,
|
||||||
|
'child_gid' : child.gramps_id})
|
||||||
family.remove_child_ref(child_ref)
|
family.remove_child_ref(child_ref)
|
||||||
self.db.commit_family(family, self.trans)
|
self.db.commit_family(family, self.trans)
|
||||||
self.broken_links.append((child_handle, family_handle))
|
self.broken_links.append((child_handle, family_handle))
|
||||||
@ -481,9 +492,10 @@ class CheckIntegrity(object):
|
|||||||
# does not exist in the database
|
# does not exist in the database
|
||||||
# This is tested by TestcaseGenerator where the father
|
# This is tested by TestcaseGenerator where the father
|
||||||
# is "Broken20"
|
# is "Broken20"
|
||||||
LOG(" FAIL: family '%s' child '%s'"
|
logging.warning(" FAIL: family '%(fam_gid)s' child "
|
||||||
" does not exist in the database" %
|
"'%(hand)s' does not exist in the database" %
|
||||||
(family.gramps_id, child_handle))
|
{'fam_gid' : family.gramps_id,
|
||||||
|
'hand' : child_handle})
|
||||||
family.remove_child_ref(child_ref)
|
family.remove_child_ref(child_ref)
|
||||||
self.db.commit_family(family, self.trans)
|
self.db.commit_family(family, self.trans)
|
||||||
self.broken_links.append((child_handle, family_handle))
|
self.broken_links.append((child_handle, family_handle))
|
||||||
@ -529,9 +541,11 @@ class CheckIntegrity(object):
|
|||||||
# Person is not a child in the referenced parent family
|
# Person is not a child in the referenced parent family
|
||||||
# This is tested by TestcaseGenerator where the father
|
# This is tested by TestcaseGenerator where the father
|
||||||
# is "Broken9"
|
# is "Broken9"
|
||||||
LOG(" FAIL: family '%s' person '%s'"
|
logging.warning(" FAIL: family '%(fam_gid)s' person "
|
||||||
" is not a child in the referenced parent family" %
|
"'%(pers_gid)s' is not a child in the "
|
||||||
(family.gramps_id, person.gramps_id))
|
"referenced parent family" %
|
||||||
|
{'fam_gid' : family.gramps_id,
|
||||||
|
'pers_gid' :person.gramps_id})
|
||||||
person.remove_parent_family_handle(par_family_handle)
|
person.remove_parent_family_handle(par_family_handle)
|
||||||
self.db.commit_person(person, self.trans)
|
self.db.commit_person(person, self.trans)
|
||||||
self.broken_links.append((person_handle,family_handle))
|
self.broken_links.append((person_handle,family_handle))
|
||||||
@ -541,9 +555,11 @@ class CheckIntegrity(object):
|
|||||||
# The referenced family does not exist in database
|
# The referenced family does not exist in database
|
||||||
# This is tested by TestcaseGenerator where the father
|
# This is tested by TestcaseGenerator where the father
|
||||||
# is "Broken20"
|
# is "Broken20"
|
||||||
LOG(" FAIL: person '%s' refers to "
|
logging.warning(" FAIL: person '%(pers_gid)s' refers to "
|
||||||
"family '%s' which is not in the database" %
|
"family '%(hand)s' which is not in the "
|
||||||
(person.gramps_id, family_handle))
|
"database" %
|
||||||
|
{'pers_gid' : person.gramps_id,
|
||||||
|
'hand' : family_handle})
|
||||||
person.remove_family_handle(family_handle)
|
person.remove_family_handle(family_handle)
|
||||||
self.db.commit_person(person, self.trans)
|
self.db.commit_person(person, self.trans)
|
||||||
self.broken_links.append((person_handle, family_handle))
|
self.broken_links.append((person_handle, family_handle))
|
||||||
@ -557,22 +573,24 @@ class CheckIntegrity(object):
|
|||||||
# "Broken2" and the family misses the link to the father, and
|
# "Broken2" and the family misses the link to the father, and
|
||||||
# where the mother is "Broken3" and the family misses the link
|
# where the mother is "Broken3" and the family misses the link
|
||||||
# to the mother
|
# to the mother
|
||||||
LOG(" FAIL: family '%s' person '%s'"
|
logging.warning(" FAIL: family '%(fam_gid)s' person "
|
||||||
" is not member of the referenced family" %
|
"'%(pers_gid)s' is not member of the referenced"
|
||||||
(family.gramps_id, person.gramps_id))
|
" family" %
|
||||||
|
{'fam_gid' : family.gramps_id,
|
||||||
|
'pers_gid' : person.gramps_id})
|
||||||
person.remove_family_handle(family_handle)
|
person.remove_family_handle(family_handle)
|
||||||
self.db.commit_person(person, self.trans)
|
self.db.commit_person(person, self.trans)
|
||||||
self.broken_links.append((person_handle, family_handle))
|
self.broken_links.append((person_handle, family_handle))
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
|
|
||||||
if previous_errors == len(self.broken_parent_links + self.broken_links):
|
if previous_errors == len(self.broken_parent_links + self.broken_links):
|
||||||
LOG(' OK: no broken family links found')
|
logging.info(' OK: no broken family links found')
|
||||||
|
|
||||||
def cleanup_missing_photos(self, cl=0):
|
def cleanup_missing_photos(self, cl=0):
|
||||||
|
|
||||||
self.progress.set_pass(_('Looking for unused objects'),
|
self.progress.set_pass(_('Looking for unused objects'),
|
||||||
len(self.db.get_media_object_handles()))
|
len(self.db.get_media_object_handles()))
|
||||||
LOG('Looking for missing photos')
|
logging.info('Looking for missing photos')
|
||||||
|
|
||||||
missmedia_action = 0
|
missmedia_action = 0
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -617,17 +635,18 @@ class CheckIntegrity(object):
|
|||||||
|
|
||||||
self.removed_photo.append(ObjectId)
|
self.removed_photo.append(ObjectId)
|
||||||
self.db.remove_object(ObjectId,self.trans)
|
self.db.remove_object(ObjectId,self.trans)
|
||||||
LOG(' FAIL: media object and all references to it removed')
|
logging.warning(' FAIL: media object and all references to '
|
||||||
|
'it removed')
|
||||||
|
|
||||||
def leave_clicked():
|
def leave_clicked():
|
||||||
self.bad_photo.append(ObjectId)
|
self.bad_photo.append(ObjectId)
|
||||||
LOG(' FAIL: references to missing file kept')
|
logging.warning(' FAIL: references to missing file kept')
|
||||||
|
|
||||||
def select_clicked():
|
def select_clicked():
|
||||||
# File is lost => select a file to replace the lost one
|
# File is lost => select a file to replace the lost one
|
||||||
def fs_close_window(obj):
|
def fs_close_window(obj):
|
||||||
self.bad_photo.append(ObjectId)
|
self.bad_photo.append(ObjectId)
|
||||||
LOG(' FAIL: references to missing file kept')
|
logging.warning(' FAIL: references to missing file kept')
|
||||||
|
|
||||||
def fs_ok_clicked(obj):
|
def fs_ok_clicked(obj):
|
||||||
name = Utils.get_unicode_path_from_file_chooser(fs_top.get_filename())
|
name = Utils.get_unicode_path_from_file_chooser(fs_top.get_filename())
|
||||||
@ -637,10 +656,11 @@ class CheckIntegrity(object):
|
|||||||
self.db.commit_media_object(obj, self.trans)
|
self.db.commit_media_object(obj, self.trans)
|
||||||
self.replaced_photo.append(ObjectId)
|
self.replaced_photo.append(ObjectId)
|
||||||
self.last_img_dir = os.path.dirname(name)
|
self.last_img_dir = os.path.dirname(name)
|
||||||
LOG(' FAIL: media object reselected to "%s"' % name)
|
logging.warning(' FAIL: media object reselected to '
|
||||||
|
'"%s"' % name)
|
||||||
else:
|
else:
|
||||||
self.bad_photo.append(ObjectId)
|
self.bad_photo.append(ObjectId)
|
||||||
LOG(' FAIL: references to missing file kept')
|
logging.warning(' FAIL: references to missing file kept')
|
||||||
|
|
||||||
fs_top = gtk.FileChooserDialog("%s - Gramps" % _("Select file"),
|
fs_top = gtk.FileChooserDialog("%s - Gramps" % _("Select file"),
|
||||||
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
|
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
|
||||||
@ -664,12 +684,16 @@ class CheckIntegrity(object):
|
|||||||
if cl:
|
if cl:
|
||||||
# Convert to file system encoding before prining
|
# Convert to file system encoding before prining
|
||||||
fn = os.path.basename(photo_name).encode(sys.getfilesystemencoding())
|
fn = os.path.basename(photo_name).encode(sys.getfilesystemencoding())
|
||||||
print ("Warning: media file %s was not found." % fn)
|
logging.warning(" FAIL: media file %s was not found." %
|
||||||
|
fn)
|
||||||
self.bad_photo.append(ObjectId)
|
self.bad_photo.append(ObjectId)
|
||||||
else:
|
else:
|
||||||
if missmedia_action == 0:
|
if missmedia_action == 0:
|
||||||
LOG(' FAIL: media object "%s" reference to missing '
|
logging.warning(' FAIL: media object "%(desc)s" '
|
||||||
'file "%s" found' % (photo_desc, photo_name))
|
'reference to missing file "%(name)s" '
|
||||||
|
'found' %
|
||||||
|
{'desc' : photo_desc,
|
||||||
|
'name' : photo_name})
|
||||||
mmd = MissingMediaDialog(_("Media object could not be found"),
|
mmd = MissingMediaDialog(_("Media object could not be found"),
|
||||||
_("The file:\n %(file_name)s \nis referenced in the database, but no longer exists. "
|
_("The file:\n %(file_name)s \nis referenced in the database, but no longer exists. "
|
||||||
"The file may have been deleted or moved to a different location. "
|
"The file may have been deleted or moved to a different location. "
|
||||||
@ -679,20 +703,29 @@ class CheckIntegrity(object):
|
|||||||
remove_clicked, leave_clicked, select_clicked)
|
remove_clicked, leave_clicked, select_clicked)
|
||||||
missmedia_action = mmd.default_action
|
missmedia_action = mmd.default_action
|
||||||
elif missmedia_action == 1:
|
elif missmedia_action == 1:
|
||||||
LOG(' FAIL: media object "%s" reference to missing '
|
logging.warning(' FAIL: media object "%(desc)s" '
|
||||||
'file "%s" found' % (photo_desc, photo_name))
|
'reference to missing file "%(name)s" '
|
||||||
|
'found' %
|
||||||
|
{'desc' : photo_desc,
|
||||||
|
'name' : photo_name})
|
||||||
remove_clicked()
|
remove_clicked()
|
||||||
elif missmedia_action == 2:
|
elif missmedia_action == 2:
|
||||||
LOG(' FAIL: media object "%s" reference to missing '
|
logging.warning(' FAIL: media object "%(desc)s" '
|
||||||
'file "%s" found' % (photo_desc, photo_name))
|
'reference to missing file "%(name)s" '
|
||||||
|
'found' %
|
||||||
|
{'desc' : photo_desc,
|
||||||
|
'name' : photo_name})
|
||||||
leave_clicked()
|
leave_clicked()
|
||||||
elif missmedia_action == 3:
|
elif missmedia_action == 3:
|
||||||
LOG(' FAIL: media object "%s" reference to missing '
|
logging.warning(' FAIL: media object "%(desc)s" '
|
||||||
'file "%s" found' % (photo_desc, photo_name))
|
'reference to missing file "%(name)s" '
|
||||||
|
'found' %
|
||||||
|
{'desc' : photo_desc,
|
||||||
|
'name' : photo_name})
|
||||||
select_clicked()
|
select_clicked()
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
if len(self.bad_photo + self.removed_photo) == 0:
|
if len(self.bad_photo + self.removed_photo) == 0:
|
||||||
LOG(' OK: no missing photos found')
|
logging.info(' OK: no missing photos found')
|
||||||
|
|
||||||
def cleanup_empty_objects(self):
|
def cleanup_empty_objects(self):
|
||||||
#the position of the change column in the primary objects
|
#the position of the change column in the primary objects
|
||||||
@ -817,22 +850,23 @@ class CheckIntegrity(object):
|
|||||||
with cursor_func() as cursor:
|
with cursor_func() as cursor:
|
||||||
total = total_func()
|
total = total_func()
|
||||||
self.progress.set_pass(text, total)
|
self.progress.set_pass(text, total)
|
||||||
LOG(text)
|
logging.info(text)
|
||||||
|
|
||||||
for handle, data in cursor:
|
for handle, data in cursor:
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
if check_func(data):
|
if check_func(data):
|
||||||
# we cannot remove here as that would destroy cursor
|
# we cannot remove here as that would destroy cursor
|
||||||
# so save the handles for later removal
|
# so save the handles for later removal
|
||||||
LOG(' FAIL: empty %s record with handle "%s" was found'
|
logging.warning(' FAIL: empty %(type)s record with '
|
||||||
% (the_type, handle))
|
'handle "%(hand)s" was found' %
|
||||||
|
{'type' : the_type, 'hand' : handle})
|
||||||
self.empty_objects[the_type].append(handle)
|
self.empty_objects[the_type].append(handle)
|
||||||
|
|
||||||
#now remove
|
#now remove
|
||||||
for handle in self.empty_objects[the_type]:
|
for handle in self.empty_objects[the_type]:
|
||||||
remove_func(handle, self.trans)
|
remove_func(handle, self.trans)
|
||||||
if len(self.empty_objects[the_type]) == 0:
|
if len(self.empty_objects[the_type]) == 0:
|
||||||
LOG(' OK: no empty %s found' % the_type)
|
logging.info(' OK: no empty %s found' % the_type)
|
||||||
|
|
||||||
def _check_empty(self, data, empty_data, changepos):
|
def _check_empty(self, data, empty_data, changepos):
|
||||||
"""compare the data with the data of an empty object
|
"""compare the data with the data of an empty object
|
||||||
@ -850,7 +884,7 @@ class CheckIntegrity(object):
|
|||||||
|
|
||||||
self.progress.set_pass(_('Looking for empty families'),
|
self.progress.set_pass(_('Looking for empty families'),
|
||||||
len(fhandle_list))
|
len(fhandle_list))
|
||||||
LOG('Looking for empty families')
|
logging.info('Looking for empty families')
|
||||||
previous_errors = len(self.empty_family)
|
previous_errors = len(self.empty_family)
|
||||||
for family_handle in fhandle_list:
|
for family_handle in fhandle_list:
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
@ -866,7 +900,7 @@ class CheckIntegrity(object):
|
|||||||
self.delete_empty_family(family_handle)
|
self.delete_empty_family(family_handle)
|
||||||
|
|
||||||
if previous_errors == len(self.empty_family):
|
if previous_errors == len(self.empty_family):
|
||||||
LOG(' OK: no empty families found')
|
logging.info(' OK: no empty families found')
|
||||||
|
|
||||||
def delete_empty_family(self, family_handle):
|
def delete_empty_family(self, family_handle):
|
||||||
for key in self.db.get_person_handles(sort_handles=False):
|
for key in self.db.get_person_handles(sort_handles=False):
|
||||||
@ -885,7 +919,7 @@ class CheckIntegrity(object):
|
|||||||
fhandle_list = self.db.get_family_handles()
|
fhandle_list = self.db.get_family_handles()
|
||||||
self.progress.set_pass(_('Looking for broken parent relationships'),
|
self.progress.set_pass(_('Looking for broken parent relationships'),
|
||||||
len(fhandle_list))
|
len(fhandle_list))
|
||||||
LOG('Looking for broken parent relationships')
|
logging.info('Looking for broken parent relationships')
|
||||||
previous_errors = len(self.fam_rel)
|
previous_errors = len(self.fam_rel)
|
||||||
|
|
||||||
for family_handle in fhandle_list:
|
for family_handle in fhandle_list:
|
||||||
@ -909,7 +943,7 @@ class CheckIntegrity(object):
|
|||||||
if (fgender == gen.lib.Person.FEMALE
|
if (fgender == gen.lib.Person.FEMALE
|
||||||
or mgender == gen.lib.Person.MALE) and fgender != mgender:
|
or mgender == gen.lib.Person.MALE) and fgender != mgender:
|
||||||
# swap. note: (at most) one handle may be None
|
# swap. note: (at most) one handle may be None
|
||||||
LOG(' FAIL: the family "%s" has a father=female or '
|
logging.warning(' FAIL: the family "%s" has a father=female or '
|
||||||
' mother=male in a different sex family' % family.gramps_id)
|
' mother=male in a different sex family' % family.gramps_id)
|
||||||
family.set_father_handle(mother_handle)
|
family.set_father_handle(mother_handle)
|
||||||
family.set_mother_handle(father_handle)
|
family.set_mother_handle(father_handle)
|
||||||
@ -917,13 +951,13 @@ class CheckIntegrity(object):
|
|||||||
self.fam_rel.append(family_handle)
|
self.fam_rel.append(family_handle)
|
||||||
|
|
||||||
if previous_errors == len(self.fam_rel):
|
if previous_errors == len(self.fam_rel):
|
||||||
LOG(' OK: no broken parent relationships found')
|
logging.info(' OK: no broken parent relationships found')
|
||||||
|
|
||||||
def check_events(self):
|
def check_events(self):
|
||||||
self.progress.set_pass(_('Looking for event problems'),
|
self.progress.set_pass(_('Looking for event problems'),
|
||||||
self.db.get_number_of_people()
|
self.db.get_number_of_people()
|
||||||
+self.db.get_number_of_families())
|
+self.db.get_number_of_families())
|
||||||
LOG('Looking for event problems')
|
logging.info('Looking for event problems')
|
||||||
|
|
||||||
for key in self.db.get_person_handles(sort_handles=False):
|
for key in self.db.get_person_handles(sort_handles=False):
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
@ -945,17 +979,21 @@ class CheckIntegrity(object):
|
|||||||
Utils.make_unknown(birth_handle, self.explanation.handle,
|
Utils.make_unknown(birth_handle, self.explanation.handle,
|
||||||
self.class_event, self.commit_event, self.trans,
|
self.class_event, self.commit_event, self.trans,
|
||||||
type=gen.lib.EventType.BIRTH)
|
type=gen.lib.EventType.BIRTH)
|
||||||
LOG(' FAIL: the person "%s" refers to a birth event'
|
logging.warning(' FAIL: the person "%(gid)s" refers to '
|
||||||
' "%s" which does not exist in the database' %
|
'a birth event "%(hand)s" which does not '
|
||||||
(person.gramps_id, birth_handle))
|
'exist in the database' %
|
||||||
|
{'gid' : person.gramps_id,
|
||||||
|
'hand' : birth_handle})
|
||||||
self.invalid_events.add(key)
|
self.invalid_events.add(key)
|
||||||
else:
|
else:
|
||||||
if int(birth.get_type()) != gen.lib.EventType.BIRTH:
|
if int(birth.get_type()) != gen.lib.EventType.BIRTH:
|
||||||
# Birth event was not of the type "Birth"
|
# Birth event was not of the type "Birth"
|
||||||
# This is tested by TestcaseGenerator person "Broken14"
|
# This is tested by TestcaseGenerator person "Broken14"
|
||||||
LOG(' FAIL: the person "%s" refers to a birth event'
|
logging.warning(' FAIL: the person "%(gid)s" refers '
|
||||||
' which is of type "%s" instead of Birth' %
|
'to a birth event which is of type '
|
||||||
(person.gramps_id, int(birth.get_type())))
|
'"%(type)s" instead of Birth' %
|
||||||
|
{'gid' : person.gramps_id,
|
||||||
|
'type' : int(birth.get_type())})
|
||||||
birth.set_type(gen.lib.EventType(gen.lib.EventType.BIRTH))
|
birth.set_type(gen.lib.EventType(gen.lib.EventType.BIRTH))
|
||||||
self.db.commit_event(birth, self.trans)
|
self.db.commit_event(birth, self.trans)
|
||||||
self.invalid_birth_events.add(key)
|
self.invalid_birth_events.add(key)
|
||||||
@ -976,9 +1014,11 @@ class CheckIntegrity(object):
|
|||||||
# The death event referenced by the death handle
|
# The death event referenced by the death handle
|
||||||
# does not exist in the database
|
# does not exist in the database
|
||||||
# This is tested by TestcaseGenerator person "Broken12"
|
# This is tested by TestcaseGenerator person "Broken12"
|
||||||
LOG(' FAIL: the person "%s" refers to a death event'
|
logging.warning(' FAIL: the person "%(gid)s" refers to '
|
||||||
' "%s" which does not exist in the database' %
|
'a death event "%(hand)s" which does not '
|
||||||
(person.gramps_id, death_handle))
|
'exist in the database' %
|
||||||
|
{'gid' : person.gramps_id,
|
||||||
|
'hand' : death_handle})
|
||||||
Utils.make_unknown(death_handle, self.explanation.handle,
|
Utils.make_unknown(death_handle, self.explanation.handle,
|
||||||
self.class_event, self.commit_event, self.trans,
|
self.class_event, self.commit_event, self.trans,
|
||||||
type=gen.lib.EventType.DEATH)
|
type=gen.lib.EventType.DEATH)
|
||||||
@ -987,9 +1027,11 @@ class CheckIntegrity(object):
|
|||||||
if int(death.get_type()) != gen.lib.EventType.DEATH:
|
if int(death.get_type()) != gen.lib.EventType.DEATH:
|
||||||
# Death event was not of the type "Death"
|
# Death event was not of the type "Death"
|
||||||
# This is tested by TestcaseGenerator person "Broken15"
|
# This is tested by TestcaseGenerator person "Broken15"
|
||||||
LOG(' FAIL: the person "%s" refers to a death event'
|
logging.warning(' FAIL: the person "%(gid)s" refers '
|
||||||
' which is of type "%s" instead of Death' %
|
'to a death event which is of type '
|
||||||
(person.gramps_id, int(death.get_type())))
|
'"%(type)s" instead of Death' %
|
||||||
|
{'gid' : person.gramps_id,
|
||||||
|
'type' : int(death.get_type())})
|
||||||
death.set_type(gen.lib.EventType(gen.lib.EventType.DEATH))
|
death.set_type(gen.lib.EventType(gen.lib.EventType.DEATH))
|
||||||
self.db.commit_event(death, self.trans)
|
self.db.commit_event(death, self.trans)
|
||||||
self.invalid_death_events.add(key)
|
self.invalid_death_events.add(key)
|
||||||
@ -1014,9 +1056,11 @@ class CheckIntegrity(object):
|
|||||||
# This is tested by TestcaseGenerator person "Broken11"
|
# This is tested by TestcaseGenerator person "Broken11"
|
||||||
# This is tested by TestcaseGenerator person "Broken12"
|
# This is tested by TestcaseGenerator person "Broken12"
|
||||||
# This is tested by TestcaseGenerator person "Broken13"
|
# This is tested by TestcaseGenerator person "Broken13"
|
||||||
LOG(' FAIL: the person "%s" refers to an event'
|
logging.warning(' FAIL: the person "%(gid)s" refers '
|
||||||
' "%s" which does not exist in the database' %
|
'to an event "%(hand)s" which does not '
|
||||||
(person.gramps_id, event_handle))
|
'exist in the database' %
|
||||||
|
{ 'gid' : person.gramps_id,
|
||||||
|
'hand' : event_handle})
|
||||||
Utils.make_unknown(event_handle,
|
Utils.make_unknown(event_handle,
|
||||||
self.explanation.handle, self.class_event,
|
self.explanation.handle, self.class_event,
|
||||||
self.commit_event, self.trans)
|
self.commit_event, self.trans)
|
||||||
@ -1026,7 +1070,7 @@ class CheckIntegrity(object):
|
|||||||
self.db.commit_person(person, self.trans)
|
self.db.commit_person(person, self.trans)
|
||||||
elif not isinstance(person.get_event_ref_list(), list):
|
elif not isinstance(person.get_event_ref_list(), list):
|
||||||
# event_list is None or other garbage
|
# event_list is None or other garbage
|
||||||
LOG(' FAIL: the person "%s" has an event ref list'
|
logging.warning(' FAIL: the person "%s" has an event ref list'
|
||||||
' which is invalid' % (person.gramps_id))
|
' which is invalid' % (person.gramps_id))
|
||||||
person.set_event_ref_list([])
|
person.set_event_ref_list([])
|
||||||
self.db.commit_person(person, self.trans)
|
self.db.commit_person(person, self.trans)
|
||||||
@ -1048,9 +1092,11 @@ class CheckIntegrity(object):
|
|||||||
if not event:
|
if not event:
|
||||||
# The event referenced by the family
|
# The event referenced by the family
|
||||||
# does not exist in the database
|
# does not exist in the database
|
||||||
LOG(' FAIL: the family "%s" refers to an event'
|
logging.warning(' FAIL: the family "%(gid)s" refers '
|
||||||
' "%s" which does not exist in the database' %
|
'to an event "%(hand)s" which does not '
|
||||||
(family.gramps_id, event_handle))
|
'exist in the database' %
|
||||||
|
{'gid' : family.gramps_id,
|
||||||
|
'hand' : event_handle})
|
||||||
Utils.make_unknown(event_handle, self.explanation,
|
Utils.make_unknown(event_handle, self.explanation,
|
||||||
self.class_event, self.commit_event, self.trans)
|
self.class_event, self.commit_event, self.trans)
|
||||||
self.invalid_events.add(key)
|
self.invalid_events.add(key)
|
||||||
@ -1059,7 +1105,7 @@ class CheckIntegrity(object):
|
|||||||
self.db.commit_family(family, self.trans)
|
self.db.commit_family(family, self.trans)
|
||||||
elif not isinstance(family.get_event_ref_list(), list):
|
elif not isinstance(family.get_event_ref_list(), list):
|
||||||
# event_list is None or other garbage
|
# event_list is None or other garbage
|
||||||
LOG(' FAIL: the family "%s" has an event ref list'
|
logging.warning(' FAIL: the family "%s" has an event ref list'
|
||||||
' which is invalid' % (family.gramps_id))
|
' which is invalid' % (family.gramps_id))
|
||||||
family.set_event_ref_list([])
|
family.set_event_ref_list([])
|
||||||
self.db.commit_family(family, self.trans)
|
self.db.commit_family(family, self.trans)
|
||||||
@ -1067,14 +1113,14 @@ class CheckIntegrity(object):
|
|||||||
|
|
||||||
if len (self.invalid_birth_events) + len(self.invalid_death_events) +\
|
if len (self.invalid_birth_events) + len(self.invalid_death_events) +\
|
||||||
len(self.invalid_events) == 0:
|
len(self.invalid_events) == 0:
|
||||||
LOG(' OK: no event problems found')
|
logging.info(' OK: no event problems found')
|
||||||
|
|
||||||
def check_person_references(self):
|
def check_person_references(self):
|
||||||
plist = self.db.get_person_handles()
|
plist = self.db.get_person_handles()
|
||||||
|
|
||||||
self.progress.set_pass(_('Looking for person reference problems'),
|
self.progress.set_pass(_('Looking for person reference problems'),
|
||||||
len(plist))
|
len(plist))
|
||||||
LOG('Looking for person reference problems')
|
logging.info('Looking for person reference problems')
|
||||||
|
|
||||||
for key in plist:
|
for key in plist:
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
@ -1097,14 +1143,14 @@ class CheckIntegrity(object):
|
|||||||
self.db.commit_person(person, self.trans)
|
self.db.commit_person(person, self.trans)
|
||||||
|
|
||||||
if len (self.invalid_person_references) == 0:
|
if len (self.invalid_person_references) == 0:
|
||||||
LOG(' OK: no event problems found')
|
logging.info(' OK: no event problems found')
|
||||||
|
|
||||||
def check_family_references(self):
|
def check_family_references(self):
|
||||||
plist = self.db.get_person_handles()
|
plist = self.db.get_person_handles()
|
||||||
|
|
||||||
self.progress.set_pass(_('Looking for family reference problems'),
|
self.progress.set_pass(_('Looking for family reference problems'),
|
||||||
len(plist))
|
len(plist))
|
||||||
LOG('Looking for family reference problems')
|
logging.info('Looking for family reference problems')
|
||||||
|
|
||||||
for key in plist:
|
for key in plist:
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
@ -1121,14 +1167,14 @@ class CheckIntegrity(object):
|
|||||||
self.invalid_family_references.add(key)
|
self.invalid_family_references.add(key)
|
||||||
|
|
||||||
if len (self.invalid_family_references) == 0:
|
if len (self.invalid_family_references) == 0:
|
||||||
LOG(' OK: no event problems found')
|
logging.info(' OK: no event problems found')
|
||||||
|
|
||||||
def check_repo_references(self):
|
def check_repo_references(self):
|
||||||
slist = self.db.get_source_handles()
|
slist = self.db.get_source_handles()
|
||||||
|
|
||||||
self.progress.set_pass(_('Looking for repository reference problems'),
|
self.progress.set_pass(_('Looking for repository reference problems'),
|
||||||
len(slist))
|
len(slist))
|
||||||
LOG('Looking for repository reference problems')
|
logging.info('Looking for repository reference problems')
|
||||||
|
|
||||||
for key in slist:
|
for key in slist:
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
@ -1151,7 +1197,7 @@ class CheckIntegrity(object):
|
|||||||
self.db.commit_source(source, self.trans)
|
self.db.commit_source(source, self.trans)
|
||||||
|
|
||||||
if len (self.invalid_repo_references) == 0:
|
if len (self.invalid_repo_references) == 0:
|
||||||
LOG(' OK: no repository reference problems found')
|
logging.info(' OK: no repository reference problems found')
|
||||||
|
|
||||||
def check_place_references(self):
|
def check_place_references(self):
|
||||||
plist = self.db.get_person_handles()
|
plist = self.db.get_person_handles()
|
||||||
@ -1159,7 +1205,7 @@ class CheckIntegrity(object):
|
|||||||
elist = self.db.get_event_handles()
|
elist = self.db.get_event_handles()
|
||||||
self.progress.set_pass(_('Looking for place reference problems'),
|
self.progress.set_pass(_('Looking for place reference problems'),
|
||||||
len(elist)+len(plist)+len(flist))
|
len(elist)+len(plist)+len(flist))
|
||||||
LOG('Looking for place reference problems')
|
logging.info('Looking for place reference problems')
|
||||||
|
|
||||||
# check persons -> the LdsOrd references a place
|
# check persons -> the LdsOrd references a place
|
||||||
for key in plist:
|
for key in plist:
|
||||||
@ -1176,9 +1222,11 @@ class CheckIntegrity(object):
|
|||||||
Utils.make_unknown(place_handle,
|
Utils.make_unknown(place_handle,
|
||||||
self.explanation.handle, self.class_place,
|
self.explanation.handle, self.class_place,
|
||||||
self.commit_place, self.trans)
|
self.commit_place, self.trans)
|
||||||
LOG(' FAIL: the person "%s" refers to an LdsOrd'
|
logging.warning(' FAIL: the person "%(gid)s" refers '
|
||||||
' place "%s" which does not exist in the database' %
|
'to an LdsOrd place "%(hand)s" which '
|
||||||
(person.gramps_id, place_handle))
|
'does not exist in the database' %
|
||||||
|
{'gid' : person.gramps_id,
|
||||||
|
'hand' : place_handle})
|
||||||
self.invalid_place_references.add(key)
|
self.invalid_place_references.add(key)
|
||||||
# check families -> the LdsOrd references a place
|
# check families -> the LdsOrd references a place
|
||||||
for key in flist:
|
for key in flist:
|
||||||
@ -1193,9 +1241,11 @@ class CheckIntegrity(object):
|
|||||||
Utils.make_unknown(place_handle,
|
Utils.make_unknown(place_handle,
|
||||||
self.explanation.handle, self.class_place,
|
self.explanation.handle, self.class_place,
|
||||||
self.commit_place, self.trans)
|
self.commit_place, self.trans)
|
||||||
LOG(' FAIL: the family "%s" refers to an LdsOrd'
|
logging.warning(' FAIL: the family "%(gid)s" refers '
|
||||||
' place "%s" which does not exist in the database' %
|
'to an LdsOrd place "%(hand)s" which '
|
||||||
(family.gramps_id, place_handle))
|
'does not exist in the database' %
|
||||||
|
{'gid' : family.gramps_id,
|
||||||
|
'hand' : place_handle})
|
||||||
self.invalid_place_references.add(key)
|
self.invalid_place_references.add(key)
|
||||||
# check events
|
# check events
|
||||||
for key in elist:
|
for key in elist:
|
||||||
@ -1209,13 +1259,15 @@ class CheckIntegrity(object):
|
|||||||
Utils.make_unknown(place_handle,
|
Utils.make_unknown(place_handle,
|
||||||
self.explanation.handle, self.class_place,
|
self.explanation.handle, self.class_place,
|
||||||
self.commit_place, self.trans)
|
self.commit_place, self.trans)
|
||||||
LOG(' FAIL: the event "%s" refers to an LdsOrd place'
|
logging.warning(' FAIL: the event "%(gid)s" refers '
|
||||||
' "%s" which does not exist in the database' %
|
'to an LdsOrd place "%(hand)s" which '
|
||||||
(event.gramps_id, place_handle))
|
'does not exist in the database' %
|
||||||
|
{'gid' : event.gramps_id,
|
||||||
|
'hand' : place_handle})
|
||||||
self.invalid_place_references.add(key)
|
self.invalid_place_references.add(key)
|
||||||
|
|
||||||
if len (self.invalid_place_references) == 0:
|
if len (self.invalid_place_references) == 0:
|
||||||
LOG(' OK: no place reference problems found')
|
logging.info(' OK: no place reference problems found')
|
||||||
|
|
||||||
def check_citation_references(self):
|
def check_citation_references(self):
|
||||||
known_handles = self.db.get_citation_handles()
|
known_handles = self.db.get_citation_handles()
|
||||||
@ -1233,7 +1285,7 @@ class CheckIntegrity(object):
|
|||||||
|
|
||||||
self.progress.set_pass(_('Looking for citation reference problems'),
|
self.progress.set_pass(_('Looking for citation reference problems'),
|
||||||
total)
|
total)
|
||||||
LOG('Looking for citation reference problems')
|
logging.info('Looking for citation reference problems')
|
||||||
|
|
||||||
for handle in self.db.person_map.keys():
|
for handle in self.db.person_map.keys():
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
@ -1356,13 +1408,13 @@ class CheckIntegrity(object):
|
|||||||
self.invalid_source_references.add(created[0].handle)
|
self.invalid_source_references.add(created[0].handle)
|
||||||
|
|
||||||
if len(self.invalid_citation_references) == 0:
|
if len(self.invalid_citation_references) == 0:
|
||||||
LOG(' OK: no citation reference problems found')
|
logging.info(' OK: no citation reference problems found')
|
||||||
|
|
||||||
def check_source_references(self):
|
def check_source_references(self):
|
||||||
clist = self.db.get_citation_handles()
|
clist = self.db.get_citation_handles()
|
||||||
self.progress.set_pass(_('Looking for source reference problems'),
|
self.progress.set_pass(_('Looking for source reference problems'),
|
||||||
len(clist))
|
len(clist))
|
||||||
LOG('Looking for source reference problems')
|
logging.info('Looking for source reference problems')
|
||||||
|
|
||||||
for key in clist:
|
for key in clist:
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
@ -1378,12 +1430,14 @@ class CheckIntegrity(object):
|
|||||||
# The referenced source does not exist in the database
|
# The referenced source does not exist in the database
|
||||||
Utils.make_unknown(source_handle, self.explanation.handle,
|
Utils.make_unknown(source_handle, self.explanation.handle,
|
||||||
self.class_source, self.commit_source, self.trans)
|
self.class_source, self.commit_source, self.trans)
|
||||||
LOG(' FAIL: the citation "%s" refers to source '
|
logging.warning(' FAIL: the citation "%(gid)s" refers '
|
||||||
' "%s" which does not exist in the database' %
|
'to source "%(hand)s" which does not exist '
|
||||||
(citation.gramps_id, source_handle))
|
'in the database' %
|
||||||
|
{'gid' : citation.gramps_id,
|
||||||
|
'hand' : source_handle})
|
||||||
self.invalid_source_references.add(key)
|
self.invalid_source_references.add(key)
|
||||||
if len(self.invalid_source_references) == 0:
|
if len(self.invalid_source_references) == 0:
|
||||||
LOG(' OK: no source reference problems found')
|
logging.info(' OK: no source reference problems found')
|
||||||
|
|
||||||
def check_media_references(self):
|
def check_media_references(self):
|
||||||
known_handles = self.db.get_media_object_handles(False)
|
known_handles = self.db.get_media_object_handles(False)
|
||||||
@ -1399,7 +1453,7 @@ class CheckIntegrity(object):
|
|||||||
|
|
||||||
self.progress.set_pass(_('Looking for media object reference problems'),
|
self.progress.set_pass(_('Looking for media object reference problems'),
|
||||||
total)
|
total)
|
||||||
LOG('Looking for media object reference problems')
|
logging.info('Looking for media object reference problems')
|
||||||
|
|
||||||
for handle in self.db.person_map.keys():
|
for handle in self.db.person_map.keys():
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
@ -1502,7 +1556,7 @@ class CheckIntegrity(object):
|
|||||||
self.class_object, self.commit_object, self.trans)
|
self.class_object, self.commit_object, self.trans)
|
||||||
|
|
||||||
if len (self.invalid_media_references) == 0:
|
if len (self.invalid_media_references) == 0:
|
||||||
LOG(' OK: no media reference problems found')
|
logging.info(' OK: no media reference problems found')
|
||||||
|
|
||||||
def check_note_references(self):
|
def check_note_references(self):
|
||||||
# Here I assume check note_references runs after all the next checks.
|
# Here I assume check note_references runs after all the next checks.
|
||||||
@ -1535,7 +1589,7 @@ class CheckIntegrity(object):
|
|||||||
|
|
||||||
self.progress.set_pass(_('Looking for note reference problems'),
|
self.progress.set_pass(_('Looking for note reference problems'),
|
||||||
total)
|
total)
|
||||||
LOG('Looking for note reference problems')
|
logging.info('Looking for note reference problems')
|
||||||
|
|
||||||
for handle in self.db.person_map.keys():
|
for handle in self.db.person_map.keys():
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
@ -1670,7 +1724,7 @@ class CheckIntegrity(object):
|
|||||||
self.class_note, self.commit_note, self.trans)
|
self.class_note, self.commit_note, self.trans)
|
||||||
|
|
||||||
if len (self.invalid_note_references) == 0:
|
if len (self.invalid_note_references) == 0:
|
||||||
LOG(' OK: no note reference problems found')
|
logging.info(' OK: no note reference problems found')
|
||||||
else:
|
else:
|
||||||
if not missing_references:
|
if not missing_references:
|
||||||
self.db.add_note(self.explanation, self.trans, set_gid=True)
|
self.db.add_note(self.explanation, self.trans, set_gid=True)
|
||||||
@ -1687,7 +1741,7 @@ class CheckIntegrity(object):
|
|||||||
|
|
||||||
self.progress.set_pass(_('Looking for tag reference problems'),
|
self.progress.set_pass(_('Looking for tag reference problems'),
|
||||||
total)
|
total)
|
||||||
LOG('Looking for tag reference problems')
|
logging.info('Looking for tag reference problems')
|
||||||
|
|
||||||
for handle in self.db.person_map.keys():
|
for handle in self.db.person_map.keys():
|
||||||
self.progress.step()
|
self.progress.step()
|
||||||
@ -1758,7 +1812,7 @@ class CheckIntegrity(object):
|
|||||||
self.commit_tag, self.trans)
|
self.commit_tag, self.trans)
|
||||||
|
|
||||||
if len(self.invalid_tag_references) == 0:
|
if len(self.invalid_tag_references) == 0:
|
||||||
LOG(' OK: no tag reference problems found')
|
logging.info(' OK: no tag reference problems found')
|
||||||
|
|
||||||
def class_person(self, handle):
|
def class_person(self, handle):
|
||||||
person = gen.lib.Person()
|
person = gen.lib.Person()
|
||||||
|
Loading…
Reference in New Issue
Block a user