3878: Private option and filter on Exporter (undo of commit 15402)

svn: r15424
This commit is contained in:
Doug Blank 2010-05-19 00:13:25 +00:00
parent 516822a795
commit 88a571d9e3
3 changed files with 30 additions and 30 deletions

View File

@ -254,6 +254,22 @@ class GedcomWriter(UpdateCallback):
self.set_total(self.progress_cnt) self.set_total(self.progress_cnt)
self.progress_cnt = 0 self.progress_cnt = 0
# If the private flag is set, apply the PrivateProxyDb
if option_box.private:
self.reset(_("Filtering private data"))
self.progress_cnt += 1
self.update(self.progress_cnt)
self.dbase = gen.proxy.PrivateProxyDb(self.dbase)
# If the restrict flag is set, apply the LivingProxyDb
if option_box.restrict:
self.reset(_("Filtering living persons"))
self.progress_cnt += 1
self.update(self.progress_cnt)
self.dbase = gen.proxy.LivingProxyDb(
self.dbase,
gen.proxy.LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY)
# If the filter returned by cfilter is not empty, apply the # If the filter returned by cfilter is not empty, apply the
# FilterProxyDb (Person Filter) # FilterProxyDb (Person Filter)
if not option_box.cfilter.is_empty(): if not option_box.cfilter.is_empty():
@ -271,22 +287,6 @@ class GedcomWriter(UpdateCallback):
self.dbase = gen.proxy.FilterProxyDb( self.dbase = gen.proxy.FilterProxyDb(
self.dbase, note_filter=option_box.nfilter) self.dbase, note_filter=option_box.nfilter)
# If the private flag is set, apply the PrivateProxyDb
if option_box.private:
self.reset(_("Filtering private data"))
self.progress_cnt += 1
self.update(self.progress_cnt)
self.dbase = gen.proxy.PrivateProxyDb(self.dbase)
# If the restrict flag is set, apply the LivingProxyDb
if option_box.restrict:
self.reset(_("Filtering living persons"))
self.progress_cnt += 1
self.update(self.progress_cnt)
self.dbase = gen.proxy.LivingProxyDb(
self.dbase,
gen.proxy.LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY)
# Apply the ReferencedProxyDb to remove any objects not referenced # Apply the ReferencedProxyDb to remove any objects not referenced
# after any of the other proxies have been applied # after any of the other proxies have been applied
if option_box.unlinked: if option_box.unlinked:

View File

@ -85,6 +85,13 @@ def writeData(database, filename, msg_callback, option_box=None, callback=None):
if option_box: if option_box:
option_box.parse_options() option_box.parse_options()
if option_box.private:
database = gen.proxy.PrivateProxyDb(database)
if option_box.restrict:
database = gen.proxy.LivingProxyDb(
database, gen.proxy.LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY)
# Apply the Person Filter # Apply the Person Filter
if not option_box.cfilter.is_empty(): if not option_box.cfilter.is_empty():
database = gen.proxy.FilterProxyDb(database, option_box.cfilter) database = gen.proxy.FilterProxyDb(database, option_box.cfilter)
@ -94,13 +101,6 @@ def writeData(database, filename, msg_callback, option_box=None, callback=None):
database = gen.proxy.FilterProxyDb( database = gen.proxy.FilterProxyDb(
database, note_filter=option_box.nfilter) database, note_filter=option_box.nfilter)
if option_box.private:
database = gen.proxy.PrivateProxyDb(database)
if option_box.restrict:
database = gen.proxy.LivingProxyDb(
database, gen.proxy.LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY)
# Apply the ReferencedProxyDb to remove any objects not referenced # Apply the ReferencedProxyDb to remove any objects not referenced
# after any of the other proxies have been applied # after any of the other proxies have been applied
if option_box.unlinked: if option_box.unlinked:

View File

@ -1164,6 +1164,13 @@ def export_data(database, filename, msg_callback, option_box=None, callback=None
if option_box: if option_box:
option_box.parse_options() option_box.parse_options()
if option_box.private:
database = gen.proxy.PrivateProxyDb(database)
if option_box.restrict:
database = gen.proxy.LivingProxyDb(
database, gen.proxy.LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY)
# Apply the Person Filter # Apply the Person Filter
if not option_box.cfilter.is_empty(): if not option_box.cfilter.is_empty():
database = gen.proxy.FilterProxyDb(database, option_box.cfilter) database = gen.proxy.FilterProxyDb(database, option_box.cfilter)
@ -1173,13 +1180,6 @@ def export_data(database, filename, msg_callback, option_box=None, callback=None
database = gen.proxy.FilterProxyDb( database = gen.proxy.FilterProxyDb(
database, note_filter=option_box.nfilter) database, note_filter=option_box.nfilter)
if option_box.private:
database = gen.proxy.PrivateProxyDb(database)
if option_box.restrict:
database = gen.proxy.LivingProxyDb(
database, gen.proxy.LivingProxyDb.MODE_INCLUDE_LAST_NAME_ONLY)
# Apply the ReferencedProxyDb to remove any objects not referenced # Apply the ReferencedProxyDb to remove any objects not referenced
# after any of the other proxies have been applied # after any of the other proxies have been applied
if option_box.unlinked: if option_box.unlinked: