Skip to content

Commit 51c169a

Browse files
committed
[FIX] *: f-strings inside _() calls
On Jammy, babel does *not* cope well with f-strings as values inside `_()` calls: it uses `eval` to try and figure them out, which attempts to execute the f-string, which fails because the evaluation context is empty. This is likely fixed from Babel 2.11 onwards (python-babel/babel#915) but Jammy uses babel 2.8[^1]. https://runbot.odoo.com/odoo/runbot.build.error/97849 [^1]: This doesn't seem to trigger on Noble even though it uses 2.10, but locally it does trigger on 2.10.3 (installed via pip), so ubuntu might have backported the fix or something. closes odoo#218887 X-original-commit: 11145d9 Signed-off-by: Xavier Morel (xmo) <[email protected]>
1 parent 0e2e7ac commit 51c169a

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

addons/mail/models/discuss/discuss_channel.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,15 +1372,13 @@ def execute_command_help(self, **kwargs):
13721372
)
13731373
else:
13741374
if members := self.channel_member_ids.filtered(lambda m: not m.is_self):
1375+
member_names = html_escape(format_list(self.env, [f"%(member_{member.id})s" for member in members])) % {
1376+
f"member_{member.id}": member._get_html_link(for_persona=True)
1377+
for member in members
1378+
}
13751379
msg = _(
13761380
"You are in a private conversation with %(member_names)s.",
1377-
member_names=html_escape(
1378-
format_list(self.env, [f"%(member_{member.id})s" for member in members])
1379-
)
1380-
% {
1381-
f"member_{member.id}": member._get_html_link(for_persona=True)
1382-
for member in members
1383-
},
1381+
member_names=member_names,
13841382
)
13851383
else:
13861384
msg = _("You are alone in a private conversation.")
@@ -1415,13 +1413,13 @@ def execute_command_who(self, **kwargs):
14151413
list_params.append(_("more"))
14161414
else:
14171415
list_params.append(_("you"))
1416+
member_names = html_escape(format_list(self.env, list_params)) % {
1417+
f"member_{member.id}": member._get_html_link(for_persona=True)
1418+
for member in members
1419+
}
14181420
msg = _(
14191421
"Users in this channel: %(members)s.",
1420-
members=html_escape(format_list(self.env, list_params))
1421-
% {
1422-
f"member_{member.id}": member._get_html_link(for_persona=True)
1423-
for member in members
1424-
},
1422+
members=member_names,
14251423
)
14261424
else:
14271425
msg = _("You are alone in this channel.")

odoo/orm/fields_relational.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def _description_domain(self, env) -> str | list:
124124
_logger.warning(env._(
125125
"Couldn't generate a company-dependent domain for field %s. "
126126
"The model doesn't have a 'company_id' or 'company_ids' field, and isn't company-dependent either.",
127-
f'{self.model_name}.{self.name}'
127+
self.model_name + '.' + self.name,
128128
))
129129
return domain
130130
company_domain = env[self.comodel_name]._check_company_domain(companies=unquote(cids))

0 commit comments

Comments
 (0)