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
4 changes: 2 additions & 2 deletions fasthtml/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ 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):
return (await f(*args, **kwargs)) if is_async_callable(f) else await run_in_threadpool(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)
Comment on lines +279 to +280

# %% ../nbs/api/00_core.ipynb #ad0f0e87
async def _wrap_ws(ws, data, params):
Expand Down
16 changes: 12 additions & 4 deletions nbs/api/00_core.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1132,8 +1132,8 @@
"outputs": [],
"source": [
"#| export\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)"
"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)"
]
},
{
Expand Down Expand Up @@ -2496,7 +2496,15 @@
"def get(): return H1('bar')\n",
"\n",
"txt = cli.get('/xt2').text\n",
"assert '<title>FastHTML page</title>' in txt and '<h1>bar</h1>' in txt and '<html>' in txt"
"assert '<title>FastHTML page</title>' in txt and '<h1>bar</h1>' in txt and '<html>' in txt\n",
"\n",
"@rt('/test-f')\n",
"def post(f: str):\n",
" return Titled('Success', P(f'Value: {f}'))\n",
"\n",
"res = cli.post('/test-f', data={'f': 'hello'})\n",
"assert res.status_code == 200\n",
"assert 'Value: hello' in res.text\n"
]
},
{
Expand Down Expand Up @@ -4865,4 +4873,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}