Removed private methods in GenericDb; fixed errors in DictionaryDb

This commit is contained in:
Doug Blank 2015-08-06 23:29:37 -04:00
parent 8bedb03d1d
commit 975572e858
2 changed files with 15 additions and 15 deletions

View File

@ -1537,7 +1537,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
Remove the Source specified by the database handle from the
database, preserving the change in the passed transaction.
"""
self.__do_remove(handle, transaction, self.source_map,
self._do_remove(handle, transaction, self.source_map,
self.source_id_map, SOURCE_KEY)
def remove_citation(self, handle, transaction):
@ -1545,7 +1545,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
Remove the Citation specified by the database handle from the
database, preserving the change in the passed transaction.
"""
self.__do_remove(handle, transaction, self.citation_map,
self._do_remove(handle, transaction, self.citation_map,
self.citation_id_map, CITATION_KEY)
def remove_event(self, handle, transaction):
@ -1553,7 +1553,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
Remove the Event specified by the database handle from the
database, preserving the change in the passed transaction.
"""
self.__do_remove(handle, transaction, self.event_map,
self._do_remove(handle, transaction, self.event_map,
self.event_id_map, EVENT_KEY)
def remove_object(self, handle, transaction):
@ -1561,7 +1561,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
Remove the MediaObjectPerson specified by the database handle from the
database, preserving the change in the passed transaction.
"""
self.__do_remove(handle, transaction, self.media_map,
self._do_remove(handle, transaction, self.media_map,
self.media_id_map, MEDIA_KEY)
def remove_place(self, handle, transaction):
@ -1569,7 +1569,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
Remove the Place specified by the database handle from the
database, preserving the change in the passed transaction.
"""
self.__do_remove(handle, transaction, self.place_map,
self._do_remove(handle, transaction, self.place_map,
self.place_id_map, PLACE_KEY)
def remove_family(self, handle, transaction):
@ -1577,7 +1577,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
Remove the Family specified by the database handle from the
database, preserving the change in the passed transaction.
"""
self.__do_remove(handle, transaction, self.family_map,
self._do_remove(handle, transaction, self.family_map,
self.family_id_map, FAMILY_KEY)
def remove_repository(self, handle, transaction):
@ -1585,7 +1585,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
Remove the Repository specified by the database handle from the
database, preserving the change in the passed transaction.
"""
self.__do_remove(handle, transaction, self.repository_map,
self._do_remove(handle, transaction, self.repository_map,
self.repository_id_map, REPOSITORY_KEY)
def remove_note(self, handle, transaction):
@ -1593,7 +1593,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
Remove the Note specified by the database handle from the
database, preserving the change in the passed transaction.
"""
self.__do_remove(handle, transaction, self.note_map,
self._do_remove(handle, transaction, self.note_map,
self.note_id_map, NOTE_KEY)
def remove_tag(self, handle, transaction):
@ -1601,7 +1601,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
Remove the Tag specified by the database handle from the
database, preserving the change in the passed transaction.
"""
self.__do_remove(handle, transaction, self.tag_map,
self._do_remove(handle, transaction, self.tag_map,
None, TAG_KEY)
def is_empty(self):

View File

@ -574,7 +574,7 @@ class DictionaryDb(DbGeneric):
transaction.add(PERSON_KEY, TXNDEL, person.handle,
person.serialize(), None)
def __do_remove(self, handle, transaction, data_map, data_id_map, key):
def _do_remove(self, handle, transaction, data_map, data_id_map, key):
key2table = {
PERSON_KEY: "person",
FAMILY_KEY: "family",
@ -630,7 +630,7 @@ class DictionaryDb(DbGeneric):
if person:
return person
if len(self._person_dict) > 0:
return self._person_dict.values()[0]
return list(self._person_dict.values())[0]
def iter_person_handles(self):
return (handle for handle in self._person_dict.keys())
@ -893,7 +893,7 @@ class DictionaryDb(DbGeneric):
gstats = {}
for person in self._person_dict.values():
if person.primary_name:
first_name = person.primary_name[0].first_name
first_name = person.primary_name.first_name
if first_name not in gstats:
gstats[first_name] = [0, 0, 0]
gstats[first_name][int(person.gender_type)] += 1
@ -915,9 +915,9 @@ class DictionaryDb(DbGeneric):
surname_list = []
for person in self._person_dict.values():
if person.primary_name:
if person.primary_name[0].surname_list:
if person.primary_name[0].surname_list[0].surname not in surname_list:
surname_list.append(person.primary_name[0].surname_list[0].surname)
if person.primary_name.surname_list:
if person.primary_name.surname_list[0].surname not in surname_list:
surname_list.append(person.primary_name.surname_list[0].surname)
return surname_list
def save_surname_list(self):