2007-06-26 Alex Roitman <shura@gramps-project.org>

* src/plugins/ReadGrdb.py (importData): Only copy environment if
	it exists.
	* src/GrampsDb/_GrampsBSDDB.py (load): Restore env_flags
	definition for TXN-less database.



svn: r8674
This commit is contained in:
Alex Roitman 2007-06-26 17:40:03 +00:00
parent 9e5571cd57
commit aee6772c66
3 changed files with 11 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2007-06-26 Alex Roitman <shura@gramps-project.org>
* src/plugins/ReadGrdb.py (importData): Only copy environment if
it exists.
* src/GrampsDb/_GrampsBSDDB.py (load): Restore env_flags
definition for TXN-less database.
2007-06-25 Alex Roitman <shura@gramps-project.org>
* src/Editors/_EditEvent.py (_connect_signals): Properly define
ok_button.

View File

@ -416,6 +416,8 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback):
# Only do recovery for existing databases
if os.path.isfile(self.full_name):
env_flags = env_flags | db.DB_RECOVER
else:
env_flags = db.DB_CREATE | db.DB_PRIVATE | db.DB_INIT_MPOOL
env_name = self.make_env_name(self.full_name)
self.env.open(env_name, env_flags)
@ -501,7 +503,6 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback):
tmp_name = tmp_name.lstrip(os.sep)
env_name = os.path.join(os.path.expanduser(const.env_dir),tmp_name)
else:
env_flags = db.DB_CREATE | db.DB_PRIVATE | db.DB_INIT_MPOOL
env_name = os.path.expanduser('~')
return env_name

View File

@ -71,9 +71,10 @@ def importData(database, filename, callback=None,cl=0,use_trans=True):
orig_env_name = other_database.make_env_name(orig_filename)
other_database.make_env_name = lambda x: new_env_name
# copy data (and env if using TXN)
# Copy data
shutil.copyfile(orig_filename,new_filename)
if other_database.UseTXN:
# Copy env if we need and if it exists
if other_database.UseTXN and os.path.isdir(orig_env_name):
shutil.rmtree(new_env_name)
shutil.copytree(orig_env_name,new_env_name)