4750: SessionLog gramplet crash
svn: r17152
This commit is contained in:
parent
c8ba5a76e3
commit
cf62cb316d
@ -1651,7 +1651,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
|||||||
"instance of DbTxn which typically happens by using the "
|
"instance of DbTxn which typically happens by using the "
|
||||||
"DbTxn instance as a context manager.")
|
"DbTxn instance as a context manager.")
|
||||||
|
|
||||||
self.transaction = transaction #only used at the start of this method.
|
self.transaction = transaction
|
||||||
if transaction.batch:
|
if transaction.batch:
|
||||||
# A batch transaction does not store the commits
|
# A batch transaction does not store the commits
|
||||||
# Aborting the session completely will become impossible.
|
# Aborting the session completely will become impossible.
|
||||||
@ -1700,7 +1700,6 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
|||||||
self.bsddbtxn.commit()
|
self.bsddbtxn.commit()
|
||||||
self.bsddbtxn = None
|
self.bsddbtxn = None
|
||||||
self.txn = None
|
self.txn = None
|
||||||
self.transaction = None
|
|
||||||
self.env.log_flush()
|
self.env.log_flush()
|
||||||
if not transaction.batch:
|
if not transaction.batch:
|
||||||
emit = self.__emit
|
emit = self.__emit
|
||||||
@ -1708,6 +1707,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
|||||||
emit(transaction, obj_type, TXNADD, obj_name, '-add')
|
emit(transaction, obj_type, TXNADD, obj_name, '-add')
|
||||||
emit(transaction, obj_type, TXNUPD, obj_name, '-update')
|
emit(transaction, obj_type, TXNUPD, obj_name, '-update')
|
||||||
emit(transaction, obj_type, TXNDEL, obj_name, '-delete')
|
emit(transaction, obj_type, TXNDEL, obj_name, '-delete')
|
||||||
|
self.transaction = None
|
||||||
transaction.clear()
|
transaction.clear()
|
||||||
self.undodb.commit(transaction, msg)
|
self.undodb.commit(transaction, msg)
|
||||||
self.__after_commit(transaction)
|
self.__after_commit(transaction)
|
||||||
@ -1744,7 +1744,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
|||||||
self.bsddbtxn.abort()
|
self.bsddbtxn.abort()
|
||||||
self.bsddbtxn = None
|
self.bsddbtxn = None
|
||||||
self.txn = None
|
self.txn = None
|
||||||
self.transaction = None
|
self.transaction = None
|
||||||
transaction.clear()
|
transaction.clear()
|
||||||
transaction.first = None
|
transaction.first = None
|
||||||
transaction.last = None
|
transaction.last = None
|
||||||
|
@ -26,9 +26,12 @@
|
|||||||
import locale
|
import locale
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
from gen.lib import Person, Family
|
||||||
|
from gen.db import PERSON_KEY, FAMILY_KEY, TXNDEL
|
||||||
from gen.plug import Gramplet
|
from gen.plug import Gramplet
|
||||||
from gen.ggettext import sgettext as _
|
from gen.ggettext import sgettext as _
|
||||||
from gen.display.name import displayer as name_displayer
|
from gen.display.name import displayer as name_displayer
|
||||||
|
from Utils import family_name
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -75,23 +78,39 @@ class LogGramplet(Gramplet):
|
|||||||
self.last_log = (ltype, action, handle)
|
self.last_log = (ltype, action, handle)
|
||||||
self.timestamp()
|
self.timestamp()
|
||||||
self.append_text("%s: " % _(action) )
|
self.append_text("%s: " % _(action) )
|
||||||
if ltype == 'Person':
|
if action == 'Deleted':
|
||||||
person = self.dbstate.db.get_person_from_handle(handle)
|
transaction = self.dbstate.db.transaction
|
||||||
name = name_displayer.display(person)
|
if ltype == 'Person':
|
||||||
elif ltype == 'Family':
|
name = 'a person'
|
||||||
family = self.dbstate.db.get_family_from_handle(handle)
|
if transaction is not None:
|
||||||
father_name = _("unknown")
|
for i in transaction.get_recnos(reverse=True):
|
||||||
mother_name = _("unknown")
|
(obj_type, trans_type, hndl, old_data, dummy) = \
|
||||||
if family:
|
transaction.get_record(i)
|
||||||
father_handle = family.get_father_handle()
|
if (obj_type == PERSON_KEY and trans_type == TXNDEL
|
||||||
if father_handle:
|
and hndl == handle):
|
||||||
father = self.dbstate.db.get_person_from_handle(father_handle)
|
person = Person()
|
||||||
if father:
|
person.unserialize(old_data)
|
||||||
father_name = name_displayer.display(father)
|
name = name_displayer.display(person)
|
||||||
mother_handle = family.get_mother_handle()
|
break
|
||||||
if mother_handle:
|
elif ltype == 'Family':
|
||||||
mother = self.dbstate.db.get_person_from_handle(mother_handle)
|
name = 'a family'
|
||||||
mother_name = name_displayer.display(mother)
|
if transaction is not None:
|
||||||
name = _("%(mother)s and %(father)s") % { 'mother' : mother_name, 'father' : father_name }
|
for i in transaction.get_recnos(reverse=True):
|
||||||
self.link(name, ltype, handle)
|
(obj_type, trans_type, hndl, old_data, dummy) = \
|
||||||
|
transaction.get_record(i)
|
||||||
|
if (obj_type == FAMILY_KEY and trans_type == TXNDEL
|
||||||
|
and hndl == handle):
|
||||||
|
family = Family()
|
||||||
|
family.unserialize(old_data)
|
||||||
|
name = family_name(family, self.dbstate.db,name)
|
||||||
|
break
|
||||||
|
self.append_text(name)
|
||||||
|
else:
|
||||||
|
if ltype == 'Person':
|
||||||
|
person = self.dbstate.db.get_person_from_handle(handle)
|
||||||
|
name = name_displayer.display(person)
|
||||||
|
elif ltype == 'Family':
|
||||||
|
family = self.dbstate.db.get_family_from_handle(handle)
|
||||||
|
name = family_name(family, self.dbstate.db, 'a family')
|
||||||
|
self.link(name, ltype, handle)
|
||||||
self.append_text("\n")
|
self.append_text("\n")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user