From 0408153557295d24fc84106191c0788a338672a2 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Wed, 11 Apr 2007 04:54:38 +0000 Subject: [PATCH] 2007-04-10 Don Allingham * src/GrampsDb/_ReadGedcom.py: add hack to force illegal "BET ABT" to be read as "EST BET" * src/ReportBase/_BareReportDialog.py: escape ampersands * src/docgen/ODFDoc.py: escape ampersands * src/ManagedWindow.py: escape ampersands svn: r8377 --- ChangeLog | 7 +++++++ src/GrampsDb/_ReadGedcom.py | 6 ++++-- src/ManagedWindow.py | 3 ++- src/ReportBase/_BareReportDialog.py | 5 +++-- src/docgen/ODFDoc.py | 8 ++++---- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 29b0ab6c6..e36a04d33 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-04-10 Don Allingham + * src/GrampsDb/_ReadGedcom.py: add hack to force illegal "BET ABT" to be read + as "EST BET" + * src/ReportBase/_BareReportDialog.py: escape ampersands + * src/docgen/ODFDoc.py: escape ampersands + * src/ManagedWindow.py: escape ampersands + 2007-04-10 Martin Hawlisch * src/plugins/ImportGeneWeb.py: Some parsing enhancements diff --git a/src/GrampsDb/_ReadGedcom.py b/src/GrampsDb/_ReadGedcom.py index 06c64ef08..38af7b55f 100644 --- a/src/GrampsDb/_ReadGedcom.py +++ b/src/GrampsDb/_ReadGedcom.py @@ -2382,8 +2382,11 @@ class GedcomParser(UpdateCallback): self.not_recognized(level+1) return date - def extract_date(self,text): + def extract_date(self, text): dateobj = RelLib.Date() + + text = text.replace('BET ABT','EST BET') # Horrible hack for Tim Lyons + try: match = intRegexp.match(text) if match: @@ -2391,7 +2394,6 @@ class GedcomParser(UpdateCallback): text, comment = match.groups() else: int_val = False - match = modRegexp.match(text) qual = None if match: diff --git a/src/ManagedWindow.py b/src/ManagedWindow.py index d2b1bc44c..5faa09039 100644 --- a/src/ManagedWindow.py +++ b/src/ManagedWindow.py @@ -395,7 +395,8 @@ class ManagedWindow: #------------------------------------------------------------------------- def set_titles(window,title,t,msg=None): if title: - title.set_text('%s' % t) + print escape(t) + title.set_text('%s' % escape(t)) title.set_use_markup(True) if msg: window.set_title('%s - GRAMPS' % msg) diff --git a/src/ReportBase/_BareReportDialog.py b/src/ReportBase/_BareReportDialog.py index 66a512a07..80bbb3a9d 100644 --- a/src/ReportBase/_BareReportDialog.py +++ b/src/ReportBase/_BareReportDialog.py @@ -27,6 +27,7 @@ #------------------------------------------------------------------------- from types import ClassType, InstanceType from gettext import gettext as _ +from xml.sax.saxutils import escape #------------------------------------------------------------------------- # @@ -126,7 +127,7 @@ class BareReportDialog(ManagedWindow.ManagedWindow): self.local_filters = [] window = gtk.Dialog('GRAMPS') - self.set_window(window,None,self.get_title()) + self.set_window(window, None, self.get_title()) self.window.set_has_separator(False) if self.HELP_TOPIC: @@ -330,7 +331,7 @@ class BareReportDialog(ManagedWindow.ManagedWindow): of the currently selected person.""" title = self.get_header(self.name) - label = gtk.Label('%s' % title) + label = gtk.Label('%s' % escape(title)) label.set_use_markup(True) self.window.vbox.pack_start(label, True, True, BareReportDialog.border_pad) diff --git a/src/docgen/ODFDoc.py b/src/docgen/ODFDoc.py index 048f7596b..95b06db8f 100644 --- a/src/docgen/ODFDoc.py +++ b/src/docgen/ODFDoc.py @@ -824,7 +824,7 @@ class ODFDoc(BaseDoc.BaseDoc): self.cntnt.write(name) self.cntnt.write('" text:outline-level="' + str(self.level) + '">') if leader != None: - self.cntnt.write(leader) + self.cntnt.write(escape(leader)) self.cntnt.write('') self.new_cell = 0 @@ -995,7 +995,7 @@ class ODFDoc(BaseDoc.BaseDoc): self.cntnt.write(' ' % pname) self.cntnt.write('\n' % pname) - self.write_text('\n'.join(text)) + self.write_text('\n'.join(escape(text))) self.cntnt.write('\n\n\n') self.cntnt.write('\n') @@ -1067,7 +1067,7 @@ class ODFDoc(BaseDoc.BaseDoc): self.cntnt.write('' % para_name) self.cntnt.write('' % font.get_size() ) - self.cntnt.write(text) + self.cntnt.write(escape(text)) self.cntnt.write('') self.cntnt.write('\n') self.cntnt.write('\n') @@ -1139,7 +1139,7 @@ class ODFDoc(BaseDoc.BaseDoc): self.cntnt.write('') self.cntnt.write('' % para_name) self.cntnt.write('' % para_name) - self.cntnt.write(text) + self.cntnt.write(escape(text)) self.cntnt.write('\n') self.cntnt.write('\n') self.cntnt.write('')