From 52d74237ae0583a2c7ce1236021615a44ea8a215 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Sat, 30 Jun 2007 18:57:34 +0000 Subject: [PATCH] 2007-06-30 Alex Roitman * src/ReportBase/_TemplateParser.py: Close file after parsing. * src/ReportBase/_ReportOptions.py (OptionListCollection.parse): Close file after parsing. * src/ReportBase/_PaperMenu.py: Close file after parsing. * src/plugins/BookReport.py (BookList.parse): Close file after parsing. * src/Filters/_FilterList.py (load): Close file after parsing. * src/BaseDoc.py (StyleSheetList.parse): Close file after parsing. svn: r8686 --- ChangeLog | 9 +++++++++ src/BaseDoc.py | 6 ++++-- src/Filters/_FilterList.py | 6 ++++-- src/ReportBase/_PaperMenu.py | 6 ++++-- src/ReportBase/_ReportOptions.py | 6 ++++-- src/ReportBase/_TemplateParser.py | 6 ++++-- src/plugins/BookReport.py | 6 ++++-- 7 files changed, 33 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1c471f660..cbd1d86c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-06-30 Alex Roitman + * src/ReportBase/_TemplateParser.py: Close file after parsing. + * src/ReportBase/_ReportOptions.py (OptionListCollection.parse): + Close file after parsing. + * src/ReportBase/_PaperMenu.py: Close file after parsing. + * src/plugins/BookReport.py (BookList.parse): Close file after parsing. + * src/Filters/_FilterList.py (load): Close file after parsing. + * src/BaseDoc.py (StyleSheetList.parse): Close file after parsing. + 2007-06-28 Alex Roitman * src/ScratchPad.py (ScratchSourceLink.tooltip): Typo. diff --git a/src/BaseDoc.py b/src/BaseDoc.py index ea3c7aa6c..a015d3108 100644 --- a/src/BaseDoc.py +++ b/src/BaseDoc.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2005 Donald N. Allingham +# Copyright (C) 2000-2007 Donald N. Allingham # # 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 @@ -922,7 +922,9 @@ class StyleSheetList: if os.path.isfile(self.file): parser = make_parser() parser.setContentHandler(SheetParser(self)) - parser.parse(self.file) + the_file = open(self.file) + parser.parse(the_file) + the_file.close() except (IOError,OSError,SAXParseException): pass diff --git a/src/Filters/_FilterList.py b/src/Filters/_FilterList.py index 9b5b9a8de..993a95bf9 100644 --- a/src/Filters/_FilterList.py +++ b/src/Filters/_FilterList.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2002-2006 Donald N. Allingham +# Copyright (C) 2002-2007 Donald N. Allingham # # 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 @@ -68,7 +68,9 @@ class FilterList: if os.path.isfile(self.file): parser = make_parser() parser.setContentHandler(FilterParser(self)) - parser.parse(self.file) + the_file = open(self.file) + parser.parse(the_file) + the_file.close() except (IOError,OSError): pass except SAXParseException: diff --git a/src/ReportBase/_PaperMenu.py b/src/ReportBase/_PaperMenu.py index b0be8f0a0..e3e92959e 100644 --- a/src/ReportBase/_PaperMenu.py +++ b/src/ReportBase/_PaperMenu.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2005 Donald N. Allingham +# Copyright (C) 2000-2007 Donald N. Allingham # # 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 @@ -175,7 +175,9 @@ class PageSizeParser(handler.ContentHandler): try: parser = make_parser() parser.setContentHandler(PageSizeParser(paper_sizes)) - parser.parse(const.papersize) + the_file = open(const.papersize) + parser.parse(the_file) + the_file.close() paper_sizes.append(BaseDoc.PaperStyle(_("Custom Size"),-1,-1)) except (IOError,OSError,SAXParseException): paper_sizes = [ diff --git a/src/ReportBase/_ReportOptions.py b/src/ReportBase/_ReportOptions.py index a3c6c3641..f24d2bd77 100644 --- a/src/ReportBase/_ReportOptions.py +++ b/src/ReportBase/_ReportOptions.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2004-2006 Donald N. Allingham +# Copyright (C) 2004-2007 Donald N. Allingham # # 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 @@ -280,7 +280,9 @@ class OptionListCollection(_Options.OptionListCollection): if os.path.isfile(self.filename): p = make_parser() p.setContentHandler(OptionParser(self)) - p.parse(self.filename) + the_file = open(self.filename) + p.parse(the_file) + the_file.close() except (IOError,OSError,SAXParseException): pass diff --git a/src/ReportBase/_TemplateParser.py b/src/ReportBase/_TemplateParser.py index c3a5af75f..9ae6208a9 100644 --- a/src/ReportBase/_TemplateParser.py +++ b/src/ReportBase/_TemplateParser.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2001-2006 Donald N. Allingham +# Copyright (C) 2001-2007 Donald N. Allingham # # 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 @@ -98,7 +98,9 @@ try: if os.path.isfile(xmlfile): parser = make_parser() parser.setContentHandler(TemplateParser(_template_map,template_path)) - parser.parse(xmlfile) + the_file = open(xmlfile) + parser.parse(the_file) + the_file.close() template_path = os.path.join(const.home_dir,"templates") xmlfile = os.path.join(template_path,"templates.xml") diff --git a/src/plugins/BookReport.py b/src/plugins/BookReport.py index b93e33e54..06b3aed70 100644 --- a/src/plugins/BookReport.py +++ b/src/plugins/BookReport.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2003-2006 Donald N. Allingham +# Copyright (C) 2003-2007 Donald N. Allingham # # 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 @@ -405,7 +405,9 @@ class BookList: try: p = make_parser() p.setContentHandler(BookParser(self)) - p.parse(self.file) + the_file = open(self.file) + p.parse(the_file) + the_file.close() except (IOError,OSError,ValueError,SAXParseException): pass