Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fasthtml/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def __init__(self, f, skip=None): self.f,self.skip = f,skip or []
def __repr__(self): return f'Beforeware({self.f}, skip={self.skip})'

# %% ../nbs/api/00_core.ipynb #78c3c357
async def _handle(f, *args, **kwargs):
async def _handle(f, /, *args, **kwargs):
return (await f(*args, **kwargs)) if is_async_callable(f) else await run_in_threadpool(f, *args, **kwargs)

# %% ../nbs/api/00_core.ipynb #ad0f0e87
Expand Down
21 changes: 16 additions & 5 deletions nbs/api/00_core.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
{
"data": {
"text/plain": [
"datetime.datetime(2026, 6, 27, 14, 0)"
"datetime.datetime(2026, 6, 29, 14, 0)"
]
},
"execution_count": null,
Expand Down Expand Up @@ -1132,10 +1132,21 @@
"outputs": [],
"source": [
"#| export\n",
"async def _handle(f, *args, **kwargs):\n",
"async def _handle(f, /, *args, **kwargs):\n",
" return (await f(*args, **kwargs)) if is_async_callable(f) else await run_in_threadpool(f, *args, **kwargs)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c995850c",
"metadata": {},
"outputs": [],
"source": [
"async def _f(f): return f\"got {f}\"\n",
"test_eq(await _handle(_f, f='hello'), 'got hello')"
]
},
{
"cell_type": "markdown",
"id": "079a3215",
Expand Down Expand Up @@ -3371,13 +3382,13 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Set to 2026-06-27 12:38:48.010675\n"
"Set to 2026-06-29 21:09:52.332526\n"
]
},
{
"data": {
"text/plain": [
"'Session time: 2026-06-27 12:38:48.010675'"
"'Session time: 2026-06-29 21:09:52.332526'"
]
},
"execution_count": null,
Expand Down Expand Up @@ -4127,7 +4138,7 @@
{
"data": {
"text/plain": [
"'Cookie was set at time 12:38:49.482843'"
"'Cookie was set at time 21:09:55.336114'"
]
},
"execution_count": null,
Expand Down