updates render_in_frontend method (takes async functions into account)

This commit is contained in:
Mose Müller 2024-02-27 11:32:18 +01:00
parent d33e9f9dbf
commit b6f6b3058e

View File

@ -56,7 +56,12 @@ def frontend(func: Callable[..., Any]) -> Callable[..., Any]:
def render_in_frontend(func: Callable[..., Any]) -> bool: def render_in_frontend(func: Callable[..., Any]) -> bool:
"""Determines if the method is decorated with the `@frontend` decorator.""" """Determines if the method should be rendered in the frontend.
It checks if the "@frontend" decorator was used or the method is a coroutine."""
if inspect.iscoroutine(func):
return True
try: try:
return func._display_in_frontend # type: ignore return func._display_in_frontend # type: ignore