diff --git a/ChangeLog b/ChangeLog index 11bc2c6ef..dd3fcde08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ 2006-05-18 Alex Roitman + * src/GrampsDb/_DbUtils.py (db_copy): Copy bookmarks and gender stats. * data/grampsxml.dtd: Update for new bookmarks. * data/grampsxml.rng: Update for new bookmarks. * src/GrampsDb/_WriteXML.py (write_bookmarks): Add method to write @@ -6,6 +7,7 @@ * src/GrampsDb/_ReadXML.py (start_bmark): Parse new bookmarks * INSTALL: Clarify; list build-dependencies. * src/GrampsDb/_ReadGrdb.py: Update progress. + (importData): Import bookmarks. 2006-05-18 Don Allingham * src/GrampsDb/_ReadGedcom.py: fix parsing level so that CHAR is not diff --git a/src/GrampsDb/_DbUtils.py b/src/GrampsDb/_DbUtils.py index f693f3f5f..a075faf5e 100644 --- a/src/GrampsDb/_DbUtils.py +++ b/src/GrampsDb/_DbUtils.py @@ -220,12 +220,21 @@ def db_copy(from_db,to_db,callback): # Commit batch transaction: does nothing, except undoing the tricks to_db.transaction_commit(trans,"") - # The metadata is always transactionless, - # and the table is small, so using key iteration is OK here. - for handle in from_db.metadata.keys(): - data = from_db.metadata.get(handle) - to_db.metadata[handle] = data + # Copy bookmarks over: + # we already know that there's no overlap in handles anywhere + to_db.bookmarks = from_db.bookmarks + to_db.family_bookmarks = from_db.family_bookmarks + to_db.event_bookmarks = from_db.event_bookmarks + to_db.source_bookmarks = from_db.source_bookmarks + to_db.place_bookmarks = from_db.place_bookmarks + to_db.media_bookmarks = from_db.media_bookmarks + to_db.repo_bookmarks = from_db.repo_bookmarks + # Copy gender stats + to_db.genderStats = from_db.genderStats + + # FIXME: need to also copy event/attr names + # TODO: need to also copy event/attr names def add_data_txn(db,table,handle,data): the_txn = db.env.txn_begin() diff --git a/src/GrampsDb/_ReadGrdb.py b/src/GrampsDb/_ReadGrdb.py index 869552652..78059ba38 100644 --- a/src/GrampsDb/_ReadGrdb.py +++ b/src/GrampsDb/_ReadGrdb.py @@ -176,6 +176,16 @@ def importData(database, filename, callback=None,cl=0,use_trans=True): import_table(id_table,add_obj,find_next_gramps_id, other_table,other_get_from_handle,trans,uc) + # Copy bookmarks over: + # we already know that there's no overlap in handles anywhere + database.bookmarks += other_database.bookmarks + database.family_bookmarks += other_database.family_bookmarks + database.event_bookmarks += other_database.event_bookmarks + database.source_bookmarks += other_database.source_bookmarks + database.place_bookmarks += other_database.place_bookmarks + database.media_bookmarks += other_database.media_bookmarks + database.repo_bookmarks += other_database.repo_bookmarks + # close the other database and clean things up other_database.close()