* src/GrampsDbBase.py: Print transaction if GRAMPS_SIGNAL=1

svn: r5131
This commit is contained in:
Martin Hawlisch 2005-08-26 21:09:47 +00:00
parent 275c60a7c6
commit 88d8e09768
2 changed files with 16 additions and 0 deletions

View File

@ -1,6 +1,7 @@
2005-08-26 Martin Hawlisch <Martin.Hawlisch@gmx.de> 2005-08-26 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/plugins/TestcaseGenerator.py: Changed param handling; * src/plugins/TestcaseGenerator.py: Changed param handling;
add more tests; make names shorter and configurable add more tests; make names shorter and configurable
* src/GrampsDbBase.py: Print transaction if GRAMPS_SIGNAL=1
2005-08-26 Don Allingham <don@gramps-project.org> 2005-08-26 Don Allingham <don@gramps-project.org>
* src/plugins/DescendChart.py: Fix spacing and line drawing, * src/plugins/DescendChart.py: Fix spacing and line drawing,

View File

@ -36,8 +36,11 @@ import random
import locale import locale
import re import re
import sets import sets
import sys
from gettext import gettext as _ from gettext import gettext as _
log = sys.stderr.write
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# GRAMPS libraries # GRAMPS libraries
@ -135,6 +138,14 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
'media-rebuild' : None, 'media-rebuild' : None,
} }
# If this is True logging will be turned on.
try:
__LOG_ALL = int(os.environ.get('GRAMPS_SIGNAL',"0")) == 1
except:
__LOG_ALL = False
def __init__(self): def __init__(self):
""" """
Creates a new GrampsDbBase instance. A new GrampDbBase class should Creates a new GrampsDbBase instance. A new GrampDbBase class should
@ -996,12 +1007,16 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
has no effect until it is committed using the transaction_commit function of has no effect until it is committed using the transaction_commit function of
the this database object. the this database object.
""" """
if self.__LOG_ALL:
log("%s: Transaction begin '%s'\n" % (self.__class__.__name__, str(msg)))
return Transaction(msg,self.undodb) return Transaction(msg,self.undodb)
def transaction_commit(self,transaction,msg): def transaction_commit(self,transaction,msg):
""" """
Commits the transaction to the assocated UNDO database. Commits the transaction to the assocated UNDO database.
""" """
if self.__LOG_ALL:
log("%s: Transaction commit '%s'\n" % (self.__class__.__name__, str(msg)))
if not len(transaction) or self.readonly: if not len(transaction) or self.readonly:
return return
transaction.set_description(msg) transaction.set_description(msg)