kopia lustrzana https://github.com/simonw/datasette
Fixed test_table_api again
rodzic
1ccf1327ae
commit
73291ab885
|
@ -85,8 +85,12 @@ def json_renderer(args, data, view_name):
|
|||
data = data["rows"]
|
||||
|
||||
elif shape == "arrays":
|
||||
if isinstance(data["rows"][0], sqlite3.Row):
|
||||
if not data["rows"]:
|
||||
pass
|
||||
elif isinstance(data["rows"][0], sqlite3.Row):
|
||||
data["rows"] = [list(row) for row in data["rows"]]
|
||||
else:
|
||||
data["rows"] = [list(row.values()) for row in data["rows"]]
|
||||
else:
|
||||
status_code = 400
|
||||
data = {
|
||||
|
|
|
@ -1602,10 +1602,8 @@ async def table_view_traced(datasette, request):
|
|||
# r.status = status_code
|
||||
else:
|
||||
assert False, f"{result} should be dict or Response"
|
||||
return r
|
||||
|
||||
if format_ == "html":
|
||||
return Response.html(
|
||||
elif format_ == "html":
|
||||
r = Response.html(
|
||||
await datasette.render_template(
|
||||
"table.html",
|
||||
dict(
|
||||
|
@ -1632,10 +1630,10 @@ async def table_view_traced(datasette, request):
|
|||
# headers=headers,
|
||||
)
|
||||
else:
|
||||
response = json_renderer(request.args, data, None)
|
||||
if next_url:
|
||||
response.headers["link"] = f'<{next_url}>; rel="next"'
|
||||
return response
|
||||
assert False, "Invalid format: {}".format(format_)
|
||||
if next_url:
|
||||
r.headers["link"] = f'<{next_url}>; rel="next"'
|
||||
return r
|
||||
|
||||
|
||||
async def table_view_data(
|
||||
|
|
Ładowanie…
Reference in New Issue