[FIX] base: python 2.6 incompatibility for dictionary comprehension

This commit is contained in:
Martin Ambroz 2014-08-20 08:42:19 +04:00 committed by Martin Trigaux
parent 11e4cad9f7
commit 106cb1ec2b
2 changed files with 4 additions and 4 deletions

View File

@ -1145,9 +1145,9 @@ class function(_column):
# if we already have a value, don't recompute it.
# This happen if case of stored many2one fields
if values and not multi and name in values[0]:
result = {v['id']: v[name] for v in values}
result = dict((v['id'], v[name]) for v in values)
elif values and multi and all(n in values[0] for n in name):
result = {v['id']: dict((n, v[n]) for n in name) for v in values}
result = dict((v['id'], dict((n, v[n]) for n in name)) for v in values)
else:
result = self._fnct(obj, cr, uid, ids, name, self._arg, context)
for id in ids:

View File

@ -830,7 +830,7 @@ def trans_generate(lang, modules, cr):
def get_module_paths():
# default addons path (base)
def_path = os.path.abspath(os.path.join(config.config['root_path'], 'addons'))
mod_paths = { def_path }
mod_paths = set([ def_path ])
ad_paths = map(lambda m: os.path.abspath(m.strip()),config.config['addons_path'].split(','))
for adp in ad_paths:
mod_paths.add(adp)
@ -838,7 +838,7 @@ def trans_generate(lang, modules, cr):
mod_paths.add(adp)
elif adp != def_path and adp.startswith(def_path):
mod_paths.add(adp[len(def_path)+1:])
return mod_paths
return list(mod_paths)
def get_module_from_path(path, mod_paths):
for mp in mod_paths: