Skip to content

Commit

Permalink
Merge pull request #385 from ForgeFlow/master-fix-convert_field_to_ht…
Browse files Browse the repository at this point in the history
…ml-fstring-compatiblity

[FIX] convert_field_to_html: f-string compatibility
  • Loading branch information
MiquelRForgeFlow authored Oct 3, 2024
2 parents faa80bf + 9fce7dc commit 8623ee4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions openupgradelib/openupgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -2473,12 +2473,18 @@ def convert_field_to_html(
if translate:
if version_info[0] < 16:
do_raise("Translatable fields are only managed in version 16.0 or higher")
cr.execute(f"SELECT id, {field_name} FROM {table};") # pylint: disable=E8103
cr.execute("SELECT id, {field_name} FROM {table};").format(
field_name=field_name, table=table
) # pylint: disable=E8103
for row in cr.fetchall():
record_id, translations = row
for lang in translations:
translations[lang] = plaintext2html(translations[lang])
query = f"update {table} set {html_field_name} = %s::jsonb where id = %s"
query = (
"update {table} set {html_field_name} = %s::jsonb where id = %s".format(
html_field_name=html_field_name, table=table
)
)
if verbose:
logged_query(cr, query, (json.dumps(translations), record_id))
else:
Expand Down

0 comments on commit 8623ee4

Please sign in to comment.