* src/plugins/NavWebPage.py: Encode using 'xmlcharrefreplace'

* src/plugins/WriteGeneWeb.py: Remove empty families before running the export. this gives now an error instead of writing an empty file; Encode using 'xmlcharrefreplace'


svn: r5147
This commit is contained in:
Martin Hawlisch 2005-08-30 15:00:34 +00:00
parent 15dd5945cf
commit 5a2cb0273e
3 changed files with 26 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2005-08-30 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/plugins/NavWebPage.py: Encode using 'xmlcharrefreplace'
* src/plugins/WriteGeneWeb.py: Remove empty families before running
the export. this gives now an error instead of writing an empty file;
Encode using 'xmlcharrefreplace'
2005-08-29 Don Allingham <don@gramps-project.org>
* src/GenericFilter.py: fixed "only one" filter rule, and matching
the descendents of a filter

View File

@ -162,10 +162,10 @@ class BasePage:
self.cur_name = self.build_name("",name)
if self.archive:
self.string_io = StringIO()
of = codecs.EncodedFile(self.string_io,'utf-8',self.encoding)
of = codecs.EncodedFile(self.string_io,'utf-8',self.encoding,'xmlcharrefreplace')
else:
page_name = os.path.join(self.html_dir,self.cur_name)
of = codecs.EncodedFile(open(page_name, "w"),'utf-8',self.encoding)
of = codecs.EncodedFile(open(page_name, "w"),'utf-8',self.encoding,'xmlcharrefreplace')
return of
def link_path(self,name,path):
@ -176,13 +176,13 @@ class BasePage:
self.cur_name = self.link_path(name,path)
if self.archive:
self.string_io = StringIO()
of = codecs.EncodedFile(self.string_io,'utf-8',self.encoding)
of = codecs.EncodedFile(self.string_io,'utf-8',self.encoding,'xmlcharrefreplace')
else:
dirname = os.path.join(self.html_dir,path,name[0],name[1])
if not os.path.isdir(dirname):
os.makedirs(dirname)
page_name = self.build_name(dirname,name)
of = codecs.EncodedFile(open(page_name, "w"),'utf-8',self.encoding)
of = codecs.EncodedFile(open(page_name, "w"),'utf-8',self.encoding,'xmlcharrefreplace')
return of
def close_file(self,of):

View File

@ -190,7 +190,20 @@ class GeneWebWriter:
p = self.db.get_person_from_handle(key)
for family_handle in p.get_family_handle_list():
self.flist[family_handle] = 1
# remove families that dont contain father AND mother
# because GeneWeb requires both to be present
templist = self.flist
self.flist = {}
for family_handle in templist:
family = self.db.get_family_from_handle(family_handle)
if family:
father_handle = family.get_father_handle()
mother_handle = family.get_mother_handle()
if father_handle and mother_handle:
self.flist[family_handle] = 1
def cl_setup(self):
self.restrict = 0
self.private = 0
@ -226,7 +239,7 @@ class GeneWebWriter:
if len(self.flist) < 1:
ErrorDialog(_("No families matched by selected filter"))
return 0
for key in self.flist:
self.write_family(key)
self.writeln("")
@ -561,7 +574,7 @@ class GeneWebWriter:
return retval
def iso8859(self,s):
return s.encode('iso-8859-1','replace')
return s.encode('iso-8859-1','xmlcharrefreplace')
#-------------------------------------------------------------------------
#