banking-addons-team team mailing list archive
-
banking-addons-team team
-
Mailing list archive
-
Message #01632
[Bug 1287626] [NEW] account_statement_base_completion: invalid regular expression: invalid escape \ sequence
Public bug reported:
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()
However, the tests are green (and they cover this query).
Replacing r"\\\1" by "\\\1" seems to work but that's annoying to have
the current code working in the tests but not with a (at least my) real
use case. I'm trying to figure out what is the corner case.
** Affects: banking-addons
Importance: Undecided
Status: New
** Description changed:
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_qoqa/trunk/parts/server/openerp/sql_db.py", line 226, in execute
- res = self._obj.execute(query, params)
+ 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()
+ 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()
However, the tests are green (and they cover this query).
Replacing r"\\\1" by "\\\1" seems to work but that's annoying to have
the current code working in the tests but not with a (at least my) real
use case. I'm trying to figure out what is the corner case.
--
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:
New
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()
However, the tests are green (and they cover this query).
Replacing r"\\\1" by "\\\1" seems to work but that's annoying to
have the current code working in the tests but not with a (at least
my) real use case. I'm trying to figure out what is the corner case.
To manage notifications about this bug go to:
https://bugs.launchpad.net/banking-addons/+bug/1287626/+subscriptions
Follow ups
References