You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[FIX] util/records: correctly replace values in JSON
The `\y` group cannot be used before a non word character otherwise we
won't math anything.
```
> select REGEXP_MATCH('a <x> b', '\y<x>\y')
+--------------+
| regexp_match |
|--------------|
| <null> |
+--------------+
> select REGEXP_MATCH('a <x> b', '<x>')
+--------------+
| regexp_match |
|--------------|
| ['<x>'] |
+--------------+
```
Also use `psycopg2.extras.Json` class to escape a string value for the
match. Example result:
```
>>> print(str(Json('\y t-if="True" >')))
'"\\\\y t-if=\\"True\\" >"'
>>> print(str(Json('\y' + re.escape(' t-if="True" >'))))
'"\\\\y\\\\ t\\\\-if=\\"True\\"\\\\ >"'
```
Note that we must remove the surrounding `'`.
opw-3526516
Part of odoo/upgrade#5233
Signed-off-by: Christophe Simonis (chs) <[email protected]>
0 commit comments