diff options
| author | nvi-openerp <nicolas.vanhoren@openerp.com> | 2010-10-26 12:00:39 +0200 |
|---|---|---|
| committer | nvi-openerp <nicolas.vanhoren@openerp.com> | 2010-10-26 12:00:39 +0200 |
| commit | 5b7affd49fa33d842f76362eb38e657fc081d77a (patch) | |
| tree | 5cf266fea9adcfbe8d9951c0fda0198b2e27617c /bin/tools | |
| parent | 1ec3503256348ba6bd1080952411c2b83d38f70e (diff) | |
| parent | 9ec0865f7c8ce62032212bcee73dc1b1f39c2b04 (diff) | |
[merge]
bzr revid: nicolas.vanhoren@openerp.com-20101026100039-dc9ev9f6lgbw3r66
Diffstat (limited to 'bin/tools')
| -rw-r--r-- | bin/tools/safe_eval.py | 3 | ||||
| -rw-r--r-- | bin/tools/yaml_import.py | 24 | ||||
| -rw-r--r-- | bin/tools/yaml_tag.py | 6 |
3 files changed, 17 insertions, 16 deletions
diff --git a/bin/tools/safe_eval.py b/bin/tools/safe_eval.py index 476ffe5e5a9..ffb9293e183 100644 --- a/bin/tools/safe_eval.py +++ b/bin/tools/safe_eval.py @@ -55,7 +55,8 @@ _EXPR_OPCODES = _CONST_OPCODES.union(set(opmap[x] for x in [ _SAFE_OPCODES = _EXPR_OPCODES.union(set(opmap[x] for x in [ 'STORE_MAP', 'LOAD_NAME', 'CALL_FUNCTION', 'COMPARE_OP', 'LOAD_ATTR', 'STORE_NAME', 'GET_ITER', 'FOR_ITER', 'LIST_APPEND', 'JUMP_ABSOLUTE', - 'DELETE_NAME', 'JUMP_IF_TRUE', 'JUMP_IF_FALSE','MAKE_FUNCTION','JUMP_FORWARD' + 'DELETE_NAME', 'JUMP_IF_TRUE', 'JUMP_IF_FALSE','MAKE_FUNCTION','JUMP_FORWARD', + 'SLICE+0', 'SLICE+1', 'SLICE+2', 'SLICE+3' ] if x in opmap)) _logger = logging.getLogger('safe_eval') diff --git a/bin/tools/yaml_import.py b/bin/tools/yaml_import.py index 8aaf34f7bf6..90fedbd0330 100644 --- a/bin/tools/yaml_import.py +++ b/bin/tools/yaml_import.py @@ -303,7 +303,7 @@ class YamlInterpreter(object): else: self.validate_xml_id(record.id) if self.isnoupdate(record) and self.mode != 'init': - id = self.pool.get('ir.model.data')._update_dummy(self.cr, self.uid, record.model, self.module, record.id) + id = self.pool.get('ir.model.data')._update_dummy(self.cr, 1, record.model, self.module, record.id) # check if the resource already existed at the last update if id: self.id_map[record] = int(id) @@ -316,7 +316,7 @@ class YamlInterpreter(object): self.logger.debug("RECORD_DICT %s" % record_dict) #context = self.get_context(record, self.eval_context) context = record.context #TOFIX: record.context like {'withoutemployee':True} should pass from self.eval_context. example: test_project.yml in project module - id = self.pool.get('ir.model.data')._update(self.cr, self.uid, record.model, \ + id = self.pool.get('ir.model.data')._update(self.cr, 1, record.model, \ self.module, record_dict, record.id, noupdate=self.isnoupdate(record), mode=self.mode, context=context) self.id_map[record.id] = int(id) if config.get('import_partial'): @@ -569,7 +569,7 @@ class YamlInterpreter(object): self._set_group_values(node, values) - pid = self.pool.get('ir.model.data')._update(self.cr, self.uid, \ + pid = self.pool.get('ir.model.data')._update(self.cr, 1, \ 'ir.ui.menu', self.module, values, node.id, mode=self.mode, \ noupdate=self.isnoupdate(node), res_id=res and res[0] or False) @@ -580,7 +580,7 @@ class YamlInterpreter(object): action_type = node.type or 'act_window' action_id = self.get_id(node.action) action = "ir.actions.%s,%d" % (action_type, action_id) - self.pool.get('ir.model.data').ir_set(self.cr, self.uid, 'action', \ + self.pool.get('ir.model.data').ir_set(self.cr, 1, 'action', \ 'tree_but_open', 'Menuitem', [('ir.ui.menu', int(parent_id))], action, True, True, xml_id=node.id) def process_act_window(self, node): @@ -614,7 +614,7 @@ class YamlInterpreter(object): if node.target: values['target'] = node.target - id = self.pool.get('ir.model.data')._update(self.cr, self.uid, \ + id = self.pool.get('ir.model.data')._update(self.cr, 1, \ 'ir.actions.act_window', self.module, values, node.id, mode=self.mode) self.id_map[node.id] = int(id) @@ -622,7 +622,7 @@ class YamlInterpreter(object): keyword = 'client_action_relate' value = 'ir.actions.act_window,%s' % id replace = node.replace or True - self.pool.get('ir.model.data').ir_set(self.cr, self.uid, 'action', keyword, \ + self.pool.get('ir.model.data').ir_set(self.cr, 1, 'action', keyword, \ node.id, [node.src_model], value, replace=replace, noupdate=self.isnoupdate(node), isobject=True, xml_id=node.id) # TODO add remove ir.model.data @@ -635,7 +635,7 @@ class YamlInterpreter(object): ids = [self.get_id(node.id)] if len(ids): self.pool.get(node.model).unlink(self.cr, self.uid, ids) - self.pool.get('ir.model.data')._unlink(self.cr, self.uid, node.model, ids) + self.pool.get('ir.model.data')._unlink(self.cr, 1, node.model, ids) else: self.logger.log(logging.TEST, "Record not deleted.") @@ -644,7 +644,7 @@ class YamlInterpreter(object): res = {'name': node.name, 'url': node.url, 'target': node.target} - id = self.pool.get('ir.model.data')._update(self.cr, self.uid, \ + id = self.pool.get('ir.model.data')._update(self.cr, 1, \ "ir.actions.url", self.module, res, node.id, mode=self.mode) self.id_map[node.id] = int(id) # ir_set @@ -652,7 +652,7 @@ class YamlInterpreter(object): keyword = node.keyword or 'client_action_multi' value = 'ir.actions.url,%s' % id replace = node.replace or True - self.pool.get('ir.model.data').ir_set(self.cr, self.uid, 'action', \ + self.pool.get('ir.model.data').ir_set(self.cr, 1, 'action', \ keyword, node.url, ["ir.actions.url"], value, replace=replace, \ noupdate=self.isnoupdate(node), isobject=True, xml_id=node.id) @@ -667,7 +667,7 @@ class YamlInterpreter(object): else: value = expression res[fieldname] = value - self.pool.get('ir.model.data').ir_set(self.cr, self.uid, res['key'], res['key2'], \ + self.pool.get('ir.model.data').ir_set(self.cr, 1, res['key'], res['key2'], \ res['name'], res['models'], res['value'], replace=res.get('replace',True), \ isobject=res.get('isobject', False), meta=res.get('meta',None)) @@ -692,7 +692,7 @@ class YamlInterpreter(object): self._set_group_values(node, values) - id = self.pool.get('ir.model.data')._update(self.cr, self.uid, "ir.actions.report.xml", \ + id = self.pool.get('ir.model.data')._update(self.cr, 1, "ir.actions.report.xml", \ self.module, values, xml_id, noupdate=self.isnoupdate(node), mode=self.mode) self.id_map[xml_id] = int(id) @@ -700,7 +700,7 @@ class YamlInterpreter(object): keyword = node.keyword or 'client_print_multi' value = 'ir.actions.report.xml,%s' % id replace = node.replace or True - self.pool.get('ir.model.data').ir_set(self.cr, self.uid, 'action', \ + self.pool.get('ir.model.data').ir_set(self.cr, 1, 'action', \ keyword, values['name'], [values['model']], value, replace=replace, isobject=True, xml_id=xml_id) def process_none(self): diff --git a/bin/tools/yaml_tag.py b/bin/tools/yaml_tag.py index 648fd56206e..e12aecdcd96 100644 --- a/bin/tools/yaml_tag.py +++ b/bin/tools/yaml_tag.py @@ -4,7 +4,7 @@ import logging class YamlTag(object): """ Superclass for constructors of custom tags defined in yaml file. - __str__ are overriden in subclass and used for serialization in module recorder. + __str__ is overriden in subclass and used for serialization in module recorder. """ def __init__(self, **kwargs): self.__dict__.update(kwargs) @@ -89,14 +89,14 @@ class Eval(YamlTag): self.expression = expression super(Eval, self).__init__() def __str__(self): - return 'eval(%s)' % (str(self.expr,)) + return '!eval %s' % str(self.expression) class Ref(YamlTag): def __init__(self, expr="False", *args, **kwargs): self.expr = expr super(Ref, self).__init__(*args, **kwargs) def __str__(self): - return 'ref(%s)' % (str(self.expr,)) + return 'ref(%s)' % repr(self.expr) class IrSet(YamlTag): def __init__(self): |
