2007-09-19 Benny Malengier <benny.malengier@gramps-project.org>

* src/GrampsDbUtils/_GedcomStageOne.py: empty gedcom gives error message, not crash



svn: r8991
This commit is contained in:
Benny Malengier 2007-09-19 07:40:55 +00:00
parent 9328d1fb4f
commit 0c1abd5a54
3 changed files with 8 additions and 0 deletions

View File

@ -1,3 +1,6 @@
2007-09-19 Benny Malengier <benny.malengier@gramps-project.org>
* src/GrampsDbUtils/_GedcomStageOne.py: empty gedcom gives error message, not crash
2007-09-17 Zsolt Foldvari <zfoldvar@users.sourceforge.net>
* src/glade/gramps.glade: Make labels translatable. #0001035

2
TODO
View File

@ -15,6 +15,8 @@
necessarily need multiple notes. Determine which ones should and
shouldn't. - DONE
* before release: fix command line options
* before release on multiple notes:
--> in note view: only show orphaned notes (notes are NOT in remove
orphaned notes tool which is what we want )

View File

@ -58,6 +58,7 @@ LOG = logging.getLogger(".GedcomImport")
BAD_UTF16 = _("Your GEDCOM file is corrupted. "
"The file appears to be encoded using the UTF16 "
"character set, but is missing the BOM marker.")
EMPTY_GED = _("Your GEDCOM file is empty.")
#-------------------------------------------------------------------------
#
@ -125,6 +126,8 @@ class StageOne:
self.enc = "UTF16"
input_file.seek(0)
return codecs.EncodedFile(input_file, 'utf8', 'utf16')
elif not line :
raise Errors.GedcomError(EMPTY_GED)
elif line[0] == "\x00" or line[1] == "\x00":
raise Errors.GedcomError(BAD_UTF16)
else: