[MERGE] latest trunk
bzr revid: abo@openerp.com-20120821172259-su6vqvxecwb5zra2 bzr revid: abo@openerp.com-20120822121220-yl5e9lhd7v4ap75a
This commit is contained in:
commit
f7a5eb5d6c
|
@ -105,7 +105,7 @@ def run_test_file(dbname, test_file):
|
||||||
db, registry = openerp.pooler.get_db_and_pool(dbname, update_module=config['init'] or config['update'], pooljobs=False)
|
db, registry = openerp.pooler.get_db_and_pool(dbname, update_module=config['init'] or config['update'], pooljobs=False)
|
||||||
cr = db.cursor()
|
cr = db.cursor()
|
||||||
_logger.info('loading test file %s', test_file)
|
_logger.info('loading test file %s', test_file)
|
||||||
openerp.tools.convert_yaml_import(cr, 'base', file(test_file), {}, 'test', True)
|
openerp.tools.convert_yaml_import(cr, 'base', file(test_file), 'test', {}, 'test', True)
|
||||||
cr.rollback()
|
cr.rollback()
|
||||||
cr.close()
|
cr.close()
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
|
@ -95,7 +95,7 @@
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Partners" version="7.0">
|
<form string="Partners" version="7.0">
|
||||||
<sheet>
|
<sheet>
|
||||||
<field name="image_medium" widget='image' class="oe_avatar oe_left"/>
|
<field name="image" widget='image' class="oe_left" options='{"preview_image": "image_medium", "size": [90, 90]}'/>
|
||||||
<div class="oe_title">
|
<div class="oe_title">
|
||||||
<div class="oe_edit_only">
|
<div class="oe_edit_only">
|
||||||
<label for="name"/> (
|
<label for="name"/> (
|
||||||
|
@ -164,7 +164,7 @@
|
||||||
<field name="phone"/>
|
<field name="phone"/>
|
||||||
<field name="street"/>
|
<field name="street"/>
|
||||||
<field name="street2"/>
|
<field name="street2"/>
|
||||||
<field name="image_small"/>
|
<field name="image"/>
|
||||||
<field name="zip"/>
|
<field name="zip"/>
|
||||||
<field name="city"/>
|
<field name="city"/>
|
||||||
<field name="country_id"/>
|
<field name="country_id"/>
|
||||||
|
@ -177,7 +177,7 @@
|
||||||
<a t-if="! read_only_mode" type="delete" style="position: absolute; right: 0; padding: 4px; diplay: inline-block">X</a>
|
<a t-if="! read_only_mode" type="delete" style="position: absolute; right: 0; padding: 4px; diplay: inline-block">X</a>
|
||||||
<div class="oe_module_vignette">
|
<div class="oe_module_vignette">
|
||||||
<a type="edit">
|
<a type="edit">
|
||||||
<img t-att-src="kanban_image('res.partner', 'image_small', record.id.value)" class="oe_avatar oe_kanban_avatar_smallbox"/>
|
<img t-att-src="kanban_image('res.partner', 'image', record.id.value, {'preview_image': 'image_small'})" class="oe_avatar oe_kanban_avatar_smallbox"/>
|
||||||
</a>
|
</a>
|
||||||
<div class="oe_module_desc">
|
<div class="oe_module_desc">
|
||||||
<div class="oe_kanban_box_content oe_kanban_color_bglight oe_kanban_box_show_onclick_trigger oe_kanban_color_border">
|
<div class="oe_kanban_box_content oe_kanban_color_bglight oe_kanban_box_show_onclick_trigger oe_kanban_color_border">
|
||||||
|
@ -204,7 +204,7 @@
|
||||||
</templates>
|
</templates>
|
||||||
</kanban>
|
</kanban>
|
||||||
<form string="Contact" version="7.0">
|
<form string="Contact" version="7.0">
|
||||||
<field name="image_small" widget='image' class="oe_avatar oe_left"/>
|
<field name="image" widget='image' class="oe_avatar oe_left" options='{"preview_image": "image_medium"}'/>
|
||||||
<div class="oe_title">
|
<div class="oe_title">
|
||||||
<group>
|
<group>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
|
@ -293,7 +293,6 @@
|
||||||
<field name="phone"/>
|
<field name="phone"/>
|
||||||
<field name="street"/>
|
<field name="street"/>
|
||||||
<field name="street2"/>
|
<field name="street2"/>
|
||||||
<field name="image_small"/>
|
|
||||||
<field name="zip"/>
|
<field name="zip"/>
|
||||||
<field name="city"/>
|
<field name="city"/>
|
||||||
<field name="country_id"/>
|
<field name="country_id"/>
|
||||||
|
|
|
@ -42,15 +42,13 @@
|
||||||
-
|
-
|
||||||
!python {model: ir.model}: |
|
!python {model: ir.model}: |
|
||||||
from tools.safe_eval import safe_eval
|
from tools.safe_eval import safe_eval
|
||||||
|
from tools.misc import mute_logger
|
||||||
try:
|
try:
|
||||||
safe_eval('open("/etc/passwd","r")')
|
with mute_logger('openerp.tools.safe_eval'):
|
||||||
assert False, "safe_eval should not allow calling open() builtin"
|
safe_eval('open("/etc/passwd","r")')
|
||||||
|
assert False, "safe_eval should not allow calling open() builtin"
|
||||||
except NameError:
|
except NameError:
|
||||||
pass
|
pass
|
||||||
except:
|
|
||||||
# NameError should be raised because open() builtin is not found,
|
|
||||||
# but other exceptions probably indicate that open() was executed!
|
|
||||||
assert False, "safe_eval should not allow calling open() builtin"
|
|
||||||
|
|
||||||
-
|
-
|
||||||
"ORM test: verify that parent_store computation are going right"
|
"ORM test: verify that parent_store computation are going right"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#
|
#
|
||||||
# OpenERP, Open Source Management Solution
|
# OpenERP, Open Source Management Solution
|
||||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||||
# Copyright (C) 2010-2011 OpenERP s.a. (<http://openerp.com>).
|
# Copyright (C) 2010-2012 OpenERP s.a. (<http://openerp.com>).
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
@ -84,7 +84,7 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules=
|
||||||
_load_data(cr, module_name, idref, mode, 'test')
|
_load_data(cr, module_name, idref, mode, 'test')
|
||||||
return True
|
return True
|
||||||
except Exception:
|
except Exception:
|
||||||
_logger.error(
|
_logger.exception(
|
||||||
'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:
|
||||||
|
@ -119,7 +119,7 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules=
|
||||||
elif ext == '.sql':
|
elif ext == '.sql':
|
||||||
process_sql_file(cr, fp)
|
process_sql_file(cr, fp)
|
||||||
elif ext == '.yml':
|
elif ext == '.yml':
|
||||||
tools.convert_yaml_import(cr, module_name, fp, idref, mode, noupdate, report)
|
tools.convert_yaml_import(cr, module_name, fp, kind, idref, mode, noupdate, report)
|
||||||
else:
|
else:
|
||||||
tools.convert_xml_import(cr, module_name, fp, idref, mode, noupdate, report)
|
tools.convert_xml_import(cr, module_name, fp, idref, mode, noupdate, report)
|
||||||
finally:
|
finally:
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
# OpenERP, Open Source Management Solution
|
# OpenERP, Open Source Management Solution
|
||||||
# Copyright (C) 2004-2011 OpenERP SA (<http://www.openerp.com>)
|
# Copyright (C) 2004-2012 OpenERP SA (<http://www.openerp.com>)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as
|
# it under the terms of the GNU Affero General Public License as
|
||||||
|
@ -376,11 +376,11 @@ def dispatch_rpc(service_name, method, params):
|
||||||
except openerp.exceptions.Warning:
|
except openerp.exceptions.Warning:
|
||||||
raise
|
raise
|
||||||
except openerp.exceptions.DeferredException, e:
|
except openerp.exceptions.DeferredException, e:
|
||||||
_logger.error(tools.exception_to_unicode(e))
|
_logger.exception(tools.exception_to_unicode(e))
|
||||||
post_mortem(e.traceback)
|
post_mortem(e.traceback)
|
||||||
raise
|
raise
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
_logger.error(tools.exception_to_unicode(e))
|
_logger.exception(tools.exception_to_unicode(e))
|
||||||
post_mortem(sys.exc_info())
|
post_mortem(sys.exc_info())
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,16 @@ def registry(model):
|
||||||
def cursor():
|
def cursor():
|
||||||
return openerp.modules.registry.RegistryManager.get(DB).db.cursor()
|
return openerp.modules.registry.RegistryManager.get(DB).db.cursor()
|
||||||
|
|
||||||
|
|
||||||
|
def drop_sequence(code):
|
||||||
|
cr = cursor()
|
||||||
|
for model in ['ir.sequence', 'ir.sequence.type']:
|
||||||
|
s = registry(model)
|
||||||
|
ids = s.search(cr, ADMIN_USER_ID, [('code', '=', code)])
|
||||||
|
s.unlink(cr, ADMIN_USER_ID, ids)
|
||||||
|
cr.commit()
|
||||||
|
cr.close()
|
||||||
|
|
||||||
class test_ir_sequence_standard(unittest2.TestCase):
|
class test_ir_sequence_standard(unittest2.TestCase):
|
||||||
""" A few tests for a 'Standard' (i.e. PostgreSQL) sequence. """
|
""" A few tests for a 'Standard' (i.e. PostgreSQL) sequence. """
|
||||||
|
|
||||||
|
@ -48,7 +58,7 @@ class test_ir_sequence_standard(unittest2.TestCase):
|
||||||
def test_ir_sequence_draw(self):
|
def test_ir_sequence_draw(self):
|
||||||
""" Try to draw a number. """
|
""" Try to draw a number. """
|
||||||
cr = cursor()
|
cr = cursor()
|
||||||
n = registry('ir.sequence').get(cr, ADMIN_USER_ID, 'test_sequence_type', {})
|
n = registry('ir.sequence').next_by_code(cr, ADMIN_USER_ID, 'test_sequence_type', {})
|
||||||
assert n
|
assert n
|
||||||
cr.commit()
|
cr.commit()
|
||||||
cr.close()
|
cr.close()
|
||||||
|
@ -57,15 +67,19 @@ class test_ir_sequence_standard(unittest2.TestCase):
|
||||||
""" Try to draw a number from two transactions. """
|
""" Try to draw a number from two transactions. """
|
||||||
cr0 = cursor()
|
cr0 = cursor()
|
||||||
cr1 = cursor()
|
cr1 = cursor()
|
||||||
n0 = registry('ir.sequence').get(cr0, ADMIN_USER_ID, 'test_sequence_type', {})
|
n0 = registry('ir.sequence').next_by_code(cr0, ADMIN_USER_ID, 'test_sequence_type', {})
|
||||||
assert n0
|
assert n0
|
||||||
n1 = registry('ir.sequence').get(cr1, ADMIN_USER_ID, 'test_sequence_type', {})
|
n1 = registry('ir.sequence').next_by_code(cr1, ADMIN_USER_ID, 'test_sequence_type', {})
|
||||||
assert n1
|
assert n1
|
||||||
cr0.commit()
|
cr0.commit()
|
||||||
cr1.commit()
|
cr1.commit()
|
||||||
cr0.close()
|
cr0.close()
|
||||||
cr1.close()
|
cr1.close()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(cls):
|
||||||
|
drop_sequence('test_sequence_type')
|
||||||
|
|
||||||
class test_ir_sequence_no_gap(unittest2.TestCase):
|
class test_ir_sequence_no_gap(unittest2.TestCase):
|
||||||
""" Copy of the previous tests for a 'No gap' sequence. """
|
""" Copy of the previous tests for a 'No gap' sequence. """
|
||||||
|
|
||||||
|
@ -85,7 +99,7 @@ class test_ir_sequence_no_gap(unittest2.TestCase):
|
||||||
def test_ir_sequence_draw_no_gap(self):
|
def test_ir_sequence_draw_no_gap(self):
|
||||||
""" Try to draw a number. """
|
""" Try to draw a number. """
|
||||||
cr = cursor()
|
cr = cursor()
|
||||||
n = registry('ir.sequence').get(cr, ADMIN_USER_ID, 'test_sequence_type_2', {})
|
n = registry('ir.sequence').next_by_code(cr, ADMIN_USER_ID, 'test_sequence_type_2', {})
|
||||||
assert n
|
assert n
|
||||||
cr.commit()
|
cr.commit()
|
||||||
cr.close()
|
cr.close()
|
||||||
|
@ -99,12 +113,16 @@ class test_ir_sequence_no_gap(unittest2.TestCase):
|
||||||
cr1._default_log_exceptions = False # Prevent logging a traceback
|
cr1._default_log_exceptions = False # Prevent logging a traceback
|
||||||
msg_re = '^could not obtain lock on row in relation "ir_sequence"$'
|
msg_re = '^could not obtain lock on row in relation "ir_sequence"$'
|
||||||
with self.assertRaisesRegexp(psycopg2.OperationalError, msg_re):
|
with self.assertRaisesRegexp(psycopg2.OperationalError, msg_re):
|
||||||
n0 = registry('ir.sequence').get(cr0, ADMIN_USER_ID, 'test_sequence_type_2', {})
|
n0 = registry('ir.sequence').next_by_code(cr0, ADMIN_USER_ID, 'test_sequence_type_2', {})
|
||||||
assert n0
|
assert n0
|
||||||
n1 = registry('ir.sequence').get(cr1, ADMIN_USER_ID, 'test_sequence_type_2', {})
|
n1 = registry('ir.sequence').next_by_code(cr1, ADMIN_USER_ID, 'test_sequence_type_2', {})
|
||||||
cr0.close()
|
cr0.close()
|
||||||
cr1.close()
|
cr1.close()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(cls):
|
||||||
|
drop_sequence('test_sequence_type_2')
|
||||||
|
|
||||||
class test_ir_sequence_change_implementation(unittest2.TestCase):
|
class test_ir_sequence_change_implementation(unittest2.TestCase):
|
||||||
""" Create sequence objects and change their ``implementation`` field. """
|
""" Create sequence objects and change their ``implementation`` field. """
|
||||||
|
|
||||||
|
@ -146,6 +164,11 @@ class test_ir_sequence_change_implementation(unittest2.TestCase):
|
||||||
cr.commit()
|
cr.commit()
|
||||||
cr.close()
|
cr.close()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(cls):
|
||||||
|
drop_sequence('test_sequence_type_3')
|
||||||
|
drop_sequence('test_sequence_type_4')
|
||||||
|
|
||||||
class test_ir_sequence_generate(unittest2.TestCase):
|
class test_ir_sequence_generate(unittest2.TestCase):
|
||||||
""" Create sequence objects and generate some values. """
|
""" Create sequence objects and generate some values. """
|
||||||
|
|
||||||
|
@ -162,7 +185,7 @@ class test_ir_sequence_generate(unittest2.TestCase):
|
||||||
cr.close()
|
cr.close()
|
||||||
|
|
||||||
cr = cursor()
|
cr = cursor()
|
||||||
f = lambda *a: registry('ir.sequence').get(cr, ADMIN_USER_ID, 'test_sequence_type_5', {})
|
f = lambda *a: registry('ir.sequence').next_by_code(cr, ADMIN_USER_ID, 'test_sequence_type_5', {})
|
||||||
assert all(str(x) == f() for x in xrange(1,1000))
|
assert all(str(x) == f() for x in xrange(1,1000))
|
||||||
cr.commit()
|
cr.commit()
|
||||||
cr.close()
|
cr.close()
|
||||||
|
@ -180,11 +203,15 @@ class test_ir_sequence_generate(unittest2.TestCase):
|
||||||
cr.close()
|
cr.close()
|
||||||
|
|
||||||
cr = cursor()
|
cr = cursor()
|
||||||
f = lambda *a: registry('ir.sequence').get(cr, ADMIN_USER_ID, 'test_sequence_type_6', {})
|
f = lambda *a: registry('ir.sequence').next_by_code(cr, ADMIN_USER_ID, 'test_sequence_type_6', {})
|
||||||
assert all(str(x) == f() for x in xrange(1,1000))
|
assert all(str(x) == f() for x in xrange(1,1000))
|
||||||
cr.commit()
|
cr.commit()
|
||||||
cr.close()
|
cr.close()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(cls):
|
||||||
|
drop_sequence('test_sequence_type_5')
|
||||||
|
drop_sequence('test_sequence_type_6')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -55,6 +55,7 @@ try:
|
||||||
from html2text import html2text
|
from html2text import html2text
|
||||||
except ImportError:
|
except ImportError:
|
||||||
html2text = None
|
html2text = None
|
||||||
|
import contextlib
|
||||||
|
|
||||||
import openerp.loglevels as loglevels
|
import openerp.loglevels as loglevels
|
||||||
import openerp.pooler as pooler
|
import openerp.pooler as pooler
|
||||||
|
@ -1140,4 +1141,20 @@ class UnquoteEvalContext(defaultdict):
|
||||||
def __missing__(self, key):
|
def __missing__(self, key):
|
||||||
return unquote(key)
|
return unquote(key)
|
||||||
|
|
||||||
|
|
||||||
|
class MuteFilter(logging.Filter):
|
||||||
|
def filter(self, record):
|
||||||
|
return 0
|
||||||
|
|
||||||
|
@contextlib.contextmanager
|
||||||
|
def mute_logger(*loggers):
|
||||||
|
mute = MuteFilter()
|
||||||
|
for logger in loggers:
|
||||||
|
logging.getLogger(logger).addFilter(mute)
|
||||||
|
|
||||||
|
yield
|
||||||
|
|
||||||
|
for logger in loggers:
|
||||||
|
logging.getLogger(logger).removeFilter(mute)
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -100,7 +100,7 @@ class RecordDictWrapper(dict):
|
||||||
return dict.__getitem__(self, key)
|
return dict.__getitem__(self, key)
|
||||||
|
|
||||||
class YamlInterpreter(object):
|
class YamlInterpreter(object):
|
||||||
def __init__(self, cr, module, id_map, mode, filename, report=None, noupdate=False):
|
def __init__(self, cr, module, id_map, mode, filename, report=None, noupdate=False, loglevel=logging.DEBUG):
|
||||||
self.cr = cr
|
self.cr = cr
|
||||||
self.module = module
|
self.module = module
|
||||||
self.id_map = id_map
|
self.id_map = id_map
|
||||||
|
@ -110,6 +110,7 @@ class YamlInterpreter(object):
|
||||||
report = assertion_report.assertion_report()
|
report = assertion_report.assertion_report()
|
||||||
self.assertion_report = report
|
self.assertion_report = report
|
||||||
self.noupdate = noupdate
|
self.noupdate = noupdate
|
||||||
|
self.loglevel = loglevel
|
||||||
self.pool = pooler.get_pool(cr.dbname)
|
self.pool = pooler.get_pool(cr.dbname)
|
||||||
self.uid = 1
|
self.uid = 1
|
||||||
self.context = {} # opererp context
|
self.context = {} # opererp context
|
||||||
|
@ -119,6 +120,9 @@ class YamlInterpreter(object):
|
||||||
'datetime': datetime,
|
'datetime': datetime,
|
||||||
'timedelta': timedelta}
|
'timedelta': timedelta}
|
||||||
|
|
||||||
|
def _log(self, *args, **kwargs):
|
||||||
|
_logger.log(self.loglevel, *args, **kwargs)
|
||||||
|
|
||||||
def _ref(self):
|
def _ref(self):
|
||||||
return lambda xml_id: self.get_id(xml_id)
|
return lambda xml_id: self.get_id(xml_id)
|
||||||
|
|
||||||
|
@ -484,12 +488,10 @@ class YamlInterpreter(object):
|
||||||
self.noupdate = node.noupdate
|
self.noupdate = node.noupdate
|
||||||
|
|
||||||
def process_python(self, node):
|
def process_python(self, node):
|
||||||
def log(msg, *args):
|
|
||||||
_logger.log(logging.TEST, msg, *args)
|
|
||||||
python, statements = node.items()[0]
|
python, statements = node.items()[0]
|
||||||
model = self.get_model(python.model)
|
model = self.get_model(python.model)
|
||||||
statements = statements.replace("\r\n", "\n")
|
statements = statements.replace("\r\n", "\n")
|
||||||
code_context = {'model': model, 'cr': self.cr, 'uid': self.uid, 'log': log, 'context': self.context}
|
code_context = {'model': model, 'cr': self.cr, 'uid': self.uid, 'log': self._log, 'context': self.context}
|
||||||
code_context.update({'self': model}) # remove me when no !python block test uses 'self' anymore
|
code_context.update({'self': model}) # remove me when no !python block test uses 'self' anymore
|
||||||
try:
|
try:
|
||||||
code_obj = compile(statements, self.filename, 'exec')
|
code_obj = compile(statements, self.filename, 'exec')
|
||||||
|
@ -720,7 +722,7 @@ class YamlInterpreter(object):
|
||||||
if len(ids):
|
if len(ids):
|
||||||
self.pool.get(node.model).unlink(self.cr, self.uid, ids)
|
self.pool.get(node.model).unlink(self.cr, self.uid, ids)
|
||||||
else:
|
else:
|
||||||
_logger.log(logging.TEST, "Record not deleted.")
|
self._log("Record not deleted.")
|
||||||
|
|
||||||
def process_url(self, node):
|
def process_url(self, node):
|
||||||
self.validate_xml_id(node.id)
|
self.validate_xml_id(node.id)
|
||||||
|
@ -805,7 +807,7 @@ class YamlInterpreter(object):
|
||||||
|
|
||||||
is_preceded_by_comment = False
|
is_preceded_by_comment = False
|
||||||
for node in yaml.load(yaml_string):
|
for node in yaml.load(yaml_string):
|
||||||
is_preceded_by_comment = self._log(node, is_preceded_by_comment)
|
is_preceded_by_comment = self._log_node(node, is_preceded_by_comment)
|
||||||
try:
|
try:
|
||||||
self._process_node(node)
|
self._process_node(node)
|
||||||
except YamlImportException, e:
|
except YamlImportException, e:
|
||||||
|
@ -852,26 +854,27 @@ class YamlInterpreter(object):
|
||||||
else:
|
else:
|
||||||
raise YamlImportException("Can not process YAML block: %s" % node)
|
raise YamlImportException("Can not process YAML block: %s" % node)
|
||||||
|
|
||||||
def _log(self, node, is_preceded_by_comment):
|
def _log_node(self, node, is_preceded_by_comment):
|
||||||
if is_comment(node):
|
if is_comment(node):
|
||||||
is_preceded_by_comment = True
|
is_preceded_by_comment = True
|
||||||
_logger.log(logging.TEST, node)
|
self._log(node)
|
||||||
elif not is_preceded_by_comment:
|
elif not is_preceded_by_comment:
|
||||||
if isinstance(node, types.DictionaryType):
|
if isinstance(node, types.DictionaryType):
|
||||||
msg = "Creating %s\n with %s"
|
msg = "Creating %s\n with %s"
|
||||||
args = node.items()[0]
|
args = node.items()[0]
|
||||||
_logger.log(logging.TEST, msg, *args)
|
self._log(msg, *args)
|
||||||
else:
|
else:
|
||||||
_logger.log(logging.TEST, node)
|
self._log(node)
|
||||||
else:
|
else:
|
||||||
is_preceded_by_comment = False
|
is_preceded_by_comment = False
|
||||||
return is_preceded_by_comment
|
return is_preceded_by_comment
|
||||||
|
|
||||||
def yaml_import(cr, module, yamlfile, idref=None, mode='init', noupdate=False, report=None):
|
def yaml_import(cr, module, yamlfile, kind, idref=None, mode='init', noupdate=False, report=None):
|
||||||
if idref is None:
|
if idref is None:
|
||||||
idref = {}
|
idref = {}
|
||||||
|
loglevel = logging.TEST if kind == 'test' else logging.DEBUG
|
||||||
yaml_string = yamlfile.read()
|
yaml_string = yamlfile.read()
|
||||||
yaml_interpreter = YamlInterpreter(cr, module, idref, mode, filename=yamlfile.name, report=report, noupdate=noupdate)
|
yaml_interpreter = YamlInterpreter(cr, module, idref, mode, filename=yamlfile.name, report=report, noupdate=noupdate, loglevel=loglevel)
|
||||||
yaml_interpreter.process(yaml_string)
|
yaml_interpreter.process(yaml_string)
|
||||||
|
|
||||||
# keeps convention of convert.py
|
# keeps convention of convert.py
|
||||||
|
|
Loading…
Reference in New Issue