** Changed in: banking-addons
Status: New => Fix Released
--
You received this bug notification because you are a member of Banking
Addons Core Editors, which is subscribed to Banking Addons.
https://bugs.launchpad.net/bugs/1287626
Title:
account_statement_base_completion: invalid regular expression: invalid
escape \ sequence
Status in OpenERP Banking Addons:
Fix Released
Bug description:
When using the autocompletion with get_from_label_and_partner_name, I
get an error:
Traceback (most recent call last):
File
"/home/gbaconnier/code/instances/openerp/trunk/parts/server/openerp/sql_db.py",
line 226, in execute
res = self._obj.execute(query, params)
DataError: invalid regular expression: invalid escape \ sequence
When it executes this query:
sql = """SELECT id FROM (
SELECT id, regexp_matches(%s,
regexp_replace(name,'([^[:alpha:]0-9 -])', %s, 'g'), 'i') AS name_match FROM
res_partner
WHERE id IN %s) AS res_patner_matcher
WHERE name_match IS NOT NULL"""
cr.execute(sql, (st_line['name'], r"\\\1",
context['partner_memoizer']))
result = cr.fetchall()
The tests are green (and they cover this query) but they do not cover
a corner case where the name contains special unicode chars.
The regexp_replace in the query escape the name, example:
"jovial ([email protected])" is escaped as "jovial
\(m.blanc\@example\.com\)".
The problem is that it escape too much characters, example:
openerp=# select regexp_replace('Jérôme blaš', '([^[:alpha:]0-9 -])', '\\\1',
'g');
regexp_replace
----------------
Jérôme bla\š
Here the 'š' should not have been escaped, resulting in the "invalid
regular expression: invalid escape \ sequence" error.
To manage notifications about this bug go to:
https://bugs.launchpad.net/banking-addons/+bug/1287626/+subscriptions
--
Mailing list: https://launchpad.net/~banking-addons-team
Post to : [email protected]
Unsubscribe : https://launchpad.net/~banking-addons-team
More help : https://help.launchpad.net/ListHelp