mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Raise ValueError if Datasette(files=) is a string, refs #1985
This commit is contained in:
parent
0a1de5d7b9
commit
b7df546a45
2 changed files with 10 additions and 1 deletions
|
|
@ -218,6 +218,8 @@ class Datasette:
|
|||
self.config_dir = config_dir
|
||||
self.pdb = pdb
|
||||
self._secret = secret or secrets.token_hex(32)
|
||||
if files is not None and isinstance(files, str):
|
||||
raise ValueError("files= must be a list of paths, not a string")
|
||||
self.files = tuple(files or []) + tuple(immutables or [])
|
||||
if config_dir:
|
||||
db_files = []
|
||||
|
|
|
|||
|
|
@ -130,7 +130,14 @@ async def test_datasette_ensure_permissions_check_visibility(
|
|||
@pytest.mark.asyncio
|
||||
async def test_datasette_render_template_no_request():
|
||||
# https://github.com/simonw/datasette/issues/1849
|
||||
ds = Datasette([], memory=True)
|
||||
ds = Datasette(memory=True)
|
||||
await ds.invoke_startup()
|
||||
rendered = await ds.render_template("error.html")
|
||||
assert "Error " in rendered
|
||||
|
||||
|
||||
def test_datasette_error_if_string_not_list(tmpdir):
|
||||
# https://github.com/simonw/datasette/issues/1985
|
||||
db_path = str(tmpdir / "data.db")
|
||||
with pytest.raises(ValueError):
|
||||
ds = Datasette(db_path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue