From 553477b1d54b51d8024418429854ec4269a1d1e8 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 --- gramps2/ChangeLog | 7 +++++++ gramps2/src/GrampsDb/_ReadGedcom.py | 6 ++++-- gramps2/src/ManagedWindow.py | 3 ++- gramps2/src/ReportBase/_BareReportDialog.py | 5 +++-- gramps2/src/docgen/ODFDoc.py | 8 ++++---- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 29b0ab6c6..e36a04d33 100644 --- a/gramps2/ChangeLog +++ b/gramps2/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/gramps2/src/GrampsDb/_ReadGedcom.py b/gramps2/src/GrampsDb/_ReadGedcom.py index 06c64ef08..38af7b55f 100644 --- a/gramps2/src/GrampsDb/_ReadGedcom.py +++ b/gramps2/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/gramps2/src/ManagedWindow.py b/gramps2/src/ManagedWindow.py index d2b1bc44c..5faa09039 100644 --- a/gramps2/src/ManagedWindow.py +++ b/gramps2/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/gramps2/src/ReportBase/_BareReportDialog.py b/gramps2/src/ReportBase/_BareReportDialog.py index 66a512a07..80bbb3a9d 100644 --- a/gramps2/src/ReportBase/_BareReportDialog.py +++ b/gramps2/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/gramps2/src/docgen/ODFDoc.py b/gramps2/src/docgen/ODFDoc.py index 048f7596b..95b06db8f 100644 --- a/gramps2/src/docgen/ODFDoc.py +++ b/gramps2/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('')