diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-10-01 16:01:54 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-10-01 16:01:54 +0200 |
| commit | 43b63a04656276926dfecd65d3058d6464ee8ac5 (patch) | |
| tree | d0f7c5b4a66540fa8422de2be928a30167e45eed /odoo/tools | |
| parent | b2870ae1ebc4d198c69142a2399827848d7d30b4 (diff) | |
| parent | 57e387b645200756c29423af463afe001707f2ac (diff) | |
[MERGE] forward port branch saas-11.4 up to 57e387b6452
Diffstat (limited to 'odoo/tools')
| -rw-r--r-- | odoo/tools/config.py | 6 | ||||
| -rw-r--r-- | odoo/tools/translate.py | 42 |
2 files changed, 27 insertions, 21 deletions
diff --git a/odoo/tools/config.py b/odoo/tools/config.py index 778fcc1def1..0f4c0d0761d 100644 --- a/odoo/tools/config.py +++ b/odoo/tools/config.py @@ -286,10 +286,12 @@ class configmanager(object): help="Specify the number of workers, 0 disable prefork mode.", type="int") group.add_option("--limit-memory-soft", dest="limit_memory_soft", my_default=2048 * 1024 * 1024, - help="Maximum allowed virtual memory per worker, when reached the worker be reset after the current request (default 671088640 aka 640MB).", + help="Maximum allowed virtual memory per worker, when reached the worker be " + "reset after the current request (default 2048MiB).", type="int") group.add_option("--limit-memory-hard", dest="limit_memory_hard", my_default=2560 * 1024 * 1024, - help="Maximum allowed virtual memory per worker, when reached, any memory allocation will fail (default 805306368 aka 768MB).", + help="Maximum allowed virtual memory per worker, when reached, any memory " + "allocation will fail (default 2560MiB).", type="int") group.add_option("--limit-time-cpu", dest="limit_time_cpu", my_default=60, help="Maximum allowed CPU time per request (default 60).", diff --git a/odoo/tools/translate.py b/odoo/tools/translate.py index 4ff7f559cf6..cb672b9d3b4 100644 --- a/odoo/tools/translate.py +++ b/odoo/tools/translate.py @@ -1038,6 +1038,7 @@ def trans_load_data(cr, fileobj, fileformat, lang, lang_name=None, verbose=True, # (Because the POT comments are correct on Launchpad but not the # PO comments due to a Launchpad limitation. See LP bug 933496.) pot_reader = [] + use_pot_reference = False # now, the serious things: we read the language file fileobj.seek(0) @@ -1066,6 +1067,7 @@ def trans_load_data(cr, fileobj, fileformat, lang, lang_name=None, verbose=True, pot_handle = file_open(os.path.join( addons, module, i18n_dir, module + '.pot'), mode='rb') pot_reader = PoFile(pot_handle) + use_pot_reference = True except: pass @@ -1100,17 +1102,18 @@ def trans_load_data(cr, fileobj, fileformat, lang, lang_name=None, verbose=True, dic['lang'] = lang dic.update(pycompat.izip(fields, row)) - # discard the target from the POT targets. - src = dic['src'] - target_key = (dic['type'], dic['name'], dic['type'] != 'code' and dic['res_id'] or 0) - target = pot_targets.get(src) - if not target or target_key not in target.targets: - _logger.info("Translation '%s' (%s, %s, %s) not found in reference pot, skipping", - src[:60], dic['type'], dic['name'], dic['res_id']) - return + if use_pot_reference: + # discard the target from the POT targets. + src = dic['src'] + target_key = (dic['type'], dic['name'], dic['type'] != 'code' and dic['res_id'] or 0) + target = pot_targets.get(src) + if not target or target_key not in target.targets: + _logger.info("Translation '%s' (%s, %s, %s) not found in reference pot, skipping", + src[:60], dic['type'], dic['name'], dic['res_id']) + return - target.value = dic['value'] - target.targets.discard(target_key) + target.value = dic['value'] + target.targets.discard(target_key) # This would skip terms that fail to specify a res_id res_id = dic['res_id'] @@ -1138,15 +1141,16 @@ def trans_load_data(cr, fileobj, fileformat, lang, lang_name=None, verbose=True, for row in reader: process_row(row) - # Then process the entries implied by the POT file (which is more - # correct w.r.t. the targets) if some of them remain. - pot_rows = [] - for src, target in pot_targets.items(): - if target.value: - for type, name, res_id in target.targets: - pot_rows.append((type, name, res_id, src, target.value, target.comments)) - for row in pot_rows: - process_row(row) + if use_pot_reference: + # Then process the entries implied by the POT file (which is more + # correct w.r.t. the targets) if some of them remain. + pot_rows = [] + for src, target in pot_targets.items(): + if target.value: + for type, name, res_id in target.targets: + pot_rows.append((type, name, res_id, src, target.value, target.comments)) + for row in pot_rows: + process_row(row) irt_cursor.finish() Translation.clear_caches() |
