upd get_callable_str async

This commit is contained in:
Alexander Kalinovsky
2025-02-13 02:00:20 +01:00
parent a0f21e0f1b
commit ca374cdea0
12 changed files with 117 additions and 83 deletions

View File

@@ -25,13 +25,23 @@ async def show_editor(message: Message | CallbackQuery, **kwargs):
value_type = field_descriptor.type_base
if field_descriptor.edit_prompt:
edit_prompt = get_callable_str(
field_descriptor.edit_prompt, field_descriptor, None, current_value
edit_prompt = await get_callable_str(
field_descriptor.edit_prompt,
field_descriptor,
callback_data
if callback_data.context == CommandContext.COMMAND_FORM
else None,
current_value,
)
else:
if field_descriptor.caption:
caption_str = get_callable_str(
field_descriptor.caption, field_descriptor, None, current_value
caption_str = await get_callable_str(
field_descriptor.caption,
field_descriptor,
callback_data
if callback_data.context == CommandContext.COMMAND_FORM
else None,
current_value,
)
else:
caption_str = field_descriptor.name
@@ -42,7 +52,7 @@ async def show_editor(message: Message | CallbackQuery, **kwargs):
)
).format(
name=caption_str,
value=get_value_repr(current_value, field_descriptor, user.lang),
value=await get_value_repr(current_value, field_descriptor, user.lang),
)
else:
edit_prompt = (