[IMP] Move threading.currentThread().testing from load_test to load_data. The purpose is to dont send mail when we are installing the demo data

bzr revid: jke@openerp.com-20131218123858-09hitdpxxqa5uh3j
This commit is contained in:
jke-openerp 2013-12-18 13:38:58 +01:00
parent 4e607334f7
commit b7a001866d
1 changed files with 12 additions and 8 deletions

View File

@ -59,7 +59,6 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules=
def load_test(module_name, idref, mode): def load_test(module_name, idref, mode):
cr.commit() cr.commit()
try: try:
threading.currentThread().testing = True
_load_data(cr, module_name, idref, mode, 'test') _load_data(cr, module_name, idref, mode, 'test')
return True return True
except Exception: except Exception:
@ -67,7 +66,6 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules=
'module %s: an exception occurred in a test', module_name) 'module %s: an exception occurred in a test', module_name)
return False return False
finally: finally:
threading.currentThread().testing = False
if tools.config.options['test_commit']: if tools.config.options['test_commit']:
cr.commit() cr.commit()
else: else:
@ -104,12 +102,18 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules=
init mode. init mode.
""" """
for filename in _get_files_of_kind(kind): try:
_logger.info("module %s: loading %s", module_name, filename) if kind in ('demo', 'test'):
noupdate = False threading.currentThread().testing = True
if kind in ('demo', 'demo_xml') or (filename.endswith('.csv') and kind in ('init', 'init_xml')): for filename in _get_files_of_kind(kind):
noupdate = True _logger.info("module %s: loading %s", module_name, filename)
tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report) noupdate = False
if kind in ('demo', 'demo_xml') or (filename.endswith('.csv') and kind in ('init', 'init_xml')):
noupdate = True
tools.convert_file(cr, module_name, filename, idref, mode, noupdate, kind, report)
finally:
if kind in ('demo', 'test'):
threading.currentThread().testing = False
if status is None: if status is None:
status = {} status = {}