BSDDB: adding missing iter methods; fixed a bug in iter by_order

This commit is contained in:
Doug Blank 2016-01-25 08:29:00 -05:00
parent a99b56e123
commit 4463d8850c
2 changed files with 21 additions and 1 deletions

View File

@ -297,6 +297,7 @@ class DbBsddbRead(DbReadBase, Callback):
"class_func": Person,
"cursor_func": self.get_person_cursor,
"handles_func": self.get_person_handles,
"iter_func": self.iter_people,
})
self._tables['Family'].update(
{
@ -305,6 +306,7 @@ class DbBsddbRead(DbReadBase, Callback):
"class_func": Family,
"cursor_func": self.get_family_cursor,
"handles_func": self.get_family_handles,
"iter_func": self.iter_families,
})
self._tables['Source'].update(
{
@ -313,6 +315,7 @@ class DbBsddbRead(DbReadBase, Callback):
"class_func": Source,
"cursor_func": self.get_source_cursor,
"handles_func": self.get_source_handles,
"iter_func": self.iter_sources,
})
self._tables['Citation'].update(
{
@ -321,6 +324,7 @@ class DbBsddbRead(DbReadBase, Callback):
"class_func": Citation,
"cursor_func": self.get_citation_cursor,
"handles_func": self.get_citation_handles,
"iter_func": self.iter_citations,
})
self._tables['Event'].update(
{
@ -329,6 +333,7 @@ class DbBsddbRead(DbReadBase, Callback):
"class_func": Event,
"cursor_func": self.get_event_cursor,
"handles_func": self.get_event_handles,
"iter_func": self.iter_events,
})
self._tables['Media'].update(
{
@ -337,6 +342,7 @@ class DbBsddbRead(DbReadBase, Callback):
"class_func": Media,
"cursor_func": self.get_media_cursor,
"handles_func": self.get_media_handles,
"iter_func": self.iter_media,
})
self._tables['Place'].update(
{
@ -345,6 +351,7 @@ class DbBsddbRead(DbReadBase, Callback):
"class_func": Place,
"cursor_func": self.get_place_cursor,
"handles_func": self.get_place_handles,
"iter_func": self.iter_places,
})
self._tables['Repository'].update(
{
@ -353,6 +360,7 @@ class DbBsddbRead(DbReadBase, Callback):
"class_func": Repository,
"cursor_func": self.get_repository_cursor,
"handles_func": self.get_repository_handles,
"iter_func": self.iter_repositories,
})
self._tables['Note'].update(
{
@ -361,6 +369,7 @@ class DbBsddbRead(DbReadBase, Callback):
"class_func": Note,
"cursor_func": self.get_note_cursor,
"handles_func": self.get_note_handles,
"iter_func": self.iter_notes,
})
self._tables['Tag'].update(
{
@ -369,6 +378,7 @@ class DbBsddbRead(DbReadBase, Callback):
"class_func": Tag,
"cursor_func": self.get_tag_cursor,
"handles_func": self.get_tag_handles,
"iter_func": self.iter_tags,
})
self.set_person_id_prefix('I%04d')
@ -1231,7 +1241,7 @@ class DbBsddbRead(DbReadBase, Callback):
pos -= 1
# now we will look them up again:
for (order_by_values, handle) in sorted_items:
yield self._tables[obj_.__class__.__name__]["handle_func"](handle)
yield self._tables[obj_.__name__]["handle_func"](handle)
return g
# Use closure to define iterators for each primary object type

View File

@ -251,6 +251,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
"commit_func": self.commit_person,
"count_func": self.get_number_of_people,
"del_func": self.remove_person,
"iter_func": self.iter_people,
})
self._tables['Family'].update(
{
@ -263,6 +264,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
"commit_func": self.commit_family,
"count_func": self.get_number_of_families,
"del_func": self.remove_family,
"iter_func": self.iter_families,
})
self._tables['Source'].update(
{
@ -275,6 +277,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
"commit_func": self.commit_source,
"count_func": self.get_number_of_sources,
"del_func": self.remove_source,
"iter_func": self.iter_sources,
})
self._tables['Citation'].update(
{
@ -287,6 +290,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
"commit_func": self.commit_citation,
"count_func": self.get_number_of_citations,
"del_func": self.remove_citation,
"iter_func": self.iter_citations,
})
self._tables['Event'].update(
{
@ -299,6 +303,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
"commit_func": self.commit_event,
"count_func": self.get_number_of_events,
"del_func": self.remove_event,
"iter_func": self.iter_events,
})
self._tables['Media'].update(
{
@ -311,6 +316,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
"commit_func": self.commit_media,
"count_func": self.get_number_of_media,
"del_func": self.remove_media,
"iter_func": self.iter_media,
})
self._tables['Place'].update(
{
@ -323,6 +329,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
"commit_func": self.commit_place,
"count_func": self.get_number_of_places,
"del_func": self.remove_place,
"iter_func": self.iter_places,
})
self._tables['Repository'].update(
{
@ -335,6 +342,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
"commit_func": self.commit_repository,
"count_func": self.get_number_of_repositories,
"del_func": self.remove_repository,
"iter_func": self.iter_repositories,
})
self._tables['Note'].update(
{
@ -347,6 +355,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
"commit_func": self.commit_note,
"count_func": self.get_number_of_notes,
"del_func": self.remove_note,
"iter_func": self.iter_notes,
})
self._tables['Tag'].update(
{
@ -359,6 +368,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
"commit_func": self.commit_tag,
"count_func": self.get_number_of_tags,
"del_func": self.remove_tag,
"iter_func": self.iter_tags,
})
self.secondary_connected = False