* src/ArgHandler.py (handle_args) Exit if opening a file failed
* src/Errors.py: New exception type "FileVersionError" * src/GrampsDbBase.py (version_supported): New method * src/GrampsBSDDB.py (version_supported): New method * src/gramps_main.py (read_file) catch FileVersionError; (post_load): only load if version_supported() * src/ReadGrdb.py (importData): only load if version_supported() svn: r4734
This commit is contained in:
@@ -1291,7 +1291,7 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
|
||||
ErrorDialog(_('Cannot open database'),
|
||||
_('The database file specified could not be opened.'))
|
||||
return 0
|
||||
except ( IOError, OSError ), msg:
|
||||
except ( IOError, OSError, Errors.FileVersionError), msg:
|
||||
ErrorDialog(_('Cannot open database'),str(msg))
|
||||
return 0
|
||||
except (db.DBAccessError,db.DBError), msg:
|
||||
@@ -1743,6 +1743,11 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
|
||||
gtk.main_iteration()
|
||||
|
||||
def post_load(self,name,callback=None):
|
||||
if not self.db.version_supported():
|
||||
raise Errors.FileVersionError(
|
||||
"The database version is not supported by this version of GRAMPS.\n"
|
||||
"Please upgrade to the corresponding version or use XML for porting data between different database versions.")
|
||||
|
||||
self.db.set_save_path(name)
|
||||
res = self.db.get_researcher()
|
||||
owner = GrampsCfg.get_researcher()
|
||||
|
||||
Reference in New Issue
Block a user