From 94f58d647cebf3e573615c0f41a45a8a71b6aa71 Mon Sep 17 00:00:00 2001 From: Alexandre Fayolle Date: Fri, 12 Feb 2016 11:52:47 +0100 Subject: [PATCH 1/2] [FIX] auth_ldap: fix authentication with special chars encode the filter in utf-8 This prevents a UnicodeDecode error in python-ldap when the filter contains non ascii characters. opw-682783 closes #10899 closes #12710 --- addons/auth_ldap/users_ldap.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/auth_ldap/users_ldap.py b/addons/auth_ldap/users_ldap.py index c920268643b..16084af80f2 100644 --- a/addons/auth_ldap/users_ldap.py +++ b/addons/auth_ldap/users_ldap.py @@ -102,7 +102,7 @@ class CompanyLDAP(osv.osv): _logger.warning('Could not format LDAP filter. Your filter should contain one \'%s\'.') return False try: - results = self.query(conf, filter) + results = self.query(conf, filter.encode('utf-8')) # Get rid of (None, attrs) for searchResultReference replies results = [i for i in results if i[0]] From 295f62741d8d416c7ce3f0af0825d5e80766ac9c Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Mon, 11 Jul 2016 18:07:05 +0200 Subject: [PATCH 2/2] [FIX] tools: cherry-pick of 0529a7f9 extract terms in correct folder If two addons path have a common part in the folder name (e.g. `/home/alice/dev` and `/home/alice/devodoo`), the `get_module_from_path` method may match the wrong folder. A file `/home/alice/devodoo/bob/models.py` would wrongly match `/home/alice/dev` path (due to the lack of separator) and the returned module would be `odoo` (`"odoo/bob/models.py".split('/')[0]`). In such scenario, the translations of files (code, static folder, report) would not be included in the exported translation file. Force the module path to ends with a folder separator to avoid wrong matching. Closes #13363 --- openerp/tools/translate.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openerp/tools/translate.py b/openerp/tools/translate.py index 532d52e4f60..7099639debd 100644 --- a/openerp/tools/translate.py +++ b/openerp/tools/translate.py @@ -859,8 +859,9 @@ def trans_generate(lang, modules, cr): def get_module_from_path(path): for (mp, rec) in path_list: + mp = os.path.join(mp, '') if rec and path.startswith(mp) and os.path.dirname(path) != mp: - path = path[len(mp)+1:] + path = path[len(mp):] return path.split(os.path.sep)[0] return 'base' # files that are not in a module are considered as being in 'base' module