python-fasthtml 0.12.44__tar.gz → 0.12.46__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_fasthtml-0.12.44/python_fasthtml.egg-info → python_fasthtml-0.12.46}/PKG-INFO +1 -1
- python_fasthtml-0.12.46/fasthtml/__init__.py +2 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/_modidx.py +1 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/core.py +3 -4
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46/python_fasthtml.egg-info}/PKG-INFO +1 -1
- python_fasthtml-0.12.44/fasthtml/__init__.py +0 -2
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/CONTRIBUTING.md +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/LICENSE +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/MANIFEST.in +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/README.md +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/authmw.py +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/basics.py +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/cli.py +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/common.py +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/components.py +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/components.pyi +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/core.pyi +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/fastapp.py +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/ft.py +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/js.py +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/jupyter.py +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/katex.js +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/live_reload.py +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/oauth.py +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/pico.py +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/starlette.py +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/stripe_otp.py +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/svg.py +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/toaster.py +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/xtend.py +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/fasthtml/xtend.pyi +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/pyproject.toml +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/python_fasthtml.egg-info/SOURCES.txt +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/python_fasthtml.egg-info/dependency_links.txt +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/python_fasthtml.egg-info/entry_points.txt +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/python_fasthtml.egg-info/requires.txt +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/python_fasthtml.egg-info/top_level.txt +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/setup.cfg +0 -0
- {python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/tests/test_toaster.py +0 -0
|
@@ -34,6 +34,7 @@ d = { 'settings': { 'branch': 'main',
|
|
|
34
34
|
'fasthtml.core.APIRouter.to_app': ('api/core.html#apirouter.to_app', 'fasthtml/core.py'),
|
|
35
35
|
'fasthtml.core.APIRouter.ws': ('api/core.html#apirouter.ws', 'fasthtml/core.py'),
|
|
36
36
|
'fasthtml.core.ApiReturn': ('api/core.html#apireturn', 'fasthtml/core.py'),
|
|
37
|
+
'fasthtml.core.ApiReturn.__bool__': ('api/core.html#apireturn.__bool__', 'fasthtml/core.py'),
|
|
37
38
|
'fasthtml.core.ApiReturn.__call__': ('api/core.html#apireturn.__call__', 'fasthtml/core.py'),
|
|
38
39
|
'fasthtml.core.ApiReturn.__from_request__': ('api/core.html#apireturn.__from_request__', 'fasthtml/core.py'),
|
|
39
40
|
'fasthtml.core.ApiReturn.__init__': ('api/core.html#apireturn.__init__', 'fasthtml/core.py'),
|
|
@@ -170,6 +170,7 @@ class ApiReturn:
|
|
|
170
170
|
async def __from_request__(cls, data, req): return cls(req.headers.get('accept')=='application/json')
|
|
171
171
|
def __init__(self, isapi=False): self.isapi = isapi
|
|
172
172
|
def __call__(self, norm, **kw): return kw if self.isapi else norm
|
|
173
|
+
def __bool__(self): return bool(self.isapi)
|
|
173
174
|
|
|
174
175
|
# %% ../nbs/api/00_core.ipynb #7cc39ba9
|
|
175
176
|
class JSONResponse(JSONResponseOrig):
|
|
@@ -188,7 +189,7 @@ async def _find_p(conn, data, hdrs, arg:str, p:Parameter):
|
|
|
188
189
|
if issubclass(anno, Starlette): return conn.scope['app']
|
|
189
190
|
if issubclass(anno, HTTPConnection): return conn
|
|
190
191
|
if issubclass(anno, State): return conn.scope['app'].state
|
|
191
|
-
if
|
|
192
|
+
if anno is dict: return data
|
|
192
193
|
if _is_body(anno):
|
|
193
194
|
if 'session'.startswith(arg.lower()): return conn.scope.get('session', {})
|
|
194
195
|
return await _from_body(conn, p, data)
|
|
@@ -222,14 +223,12 @@ async def _find_p(conn, data, hdrs, arg:str, p:Parameter):
|
|
|
222
223
|
if isinstance(conn, Request): raise HTTPException(400, f"Missing required field: {arg}")
|
|
223
224
|
raise ValueError(f"Missing required field: {arg}")
|
|
224
225
|
res = p.default
|
|
225
|
-
|
|
226
|
-
if not isinstance(res, (list,str)) or anno is empty: return res
|
|
226
|
+
if anno is empty: return res
|
|
227
227
|
try: return _fix_anno(anno, res)
|
|
228
228
|
except ValueError as e:
|
|
229
229
|
if isinstance(conn, Request): raise HTTPException(404, f"{conn.url.path}: {e}") from None
|
|
230
230
|
raise
|
|
231
231
|
|
|
232
|
-
|
|
233
232
|
# %% ../nbs/api/00_core.ipynb #bf42edad
|
|
234
233
|
async def _find_ps(conn, data, hdrs, params):
|
|
235
234
|
if conn.query_params: data |= dict(conn.query_params)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/python_fasthtml.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{python_fasthtml-0.12.44 → python_fasthtml-0.12.46}/python_fasthtml.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|