Apply referenced proxy to remove unused objects when a filter or one of the other proxies is applied.

svn: r10846
This commit is contained in:
Gary Burton 2008-07-07 19:32:18 +00:00
parent b2f0e1e537
commit 3cc07e26dd
2 changed files with 14 additions and 0 deletions

View File

@ -3,6 +3,7 @@
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2008 Brian G. Matherly
# Copyright (C) 2008 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -340,6 +341,12 @@ class GedcomWriter(BasicUtils.UpdateCallback):
self.dbase = gen.proxy.FilterProxyDb(
self.dbase, option_box.cfilter)
# Apply the ReferencedProxyDb to remove any objects not referenced
# after any of the other proxies have been applied
if option_box.private or option_box.restrict \
or not option_box.cfilter.is_empty():
self.dbase = gen.proxy.ReferencedProxyDb(self.dbase)
def write_gedcom_file(self, filename):
"""
Write the actual GEDCOM file to the specfied filename.

View File

@ -3,6 +3,7 @@
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2008 Brian G. Matherly
# Copyright (C) 2008 Gary Burton
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -93,6 +94,12 @@ def export_data(database, filename, person, option_box, callback=None):
if not option_box.cfilter.is_empty():
database = gen.proxy.FilterProxyDb(database, option_box.cfilter)
# Apply the ReferencedProxyDb to remove any objects not referenced
# after any of the other proxies have been applied
if option_box.private or option_box.restrict \
or not option_box.cfilter.is_empty():
database = gen.proxy.ReferencedProxyDb(database)
g = XmlWriter(database, callback, 0, compress)
return g.write(filename)