kopia lustrzana https://github.com/simonw/datasette
Porównaj commity
7 Commity
3f74c7a368
...
c570deafd9
Autor | SHA1 | Data |
---|---|---|
Timothy O'Leary | c570deafd9 | |
Ian Chartier | c701a64da2 | |
Tyler McKenzie | a0577796da | |
Tyler McKenzie | 77392cf62c | |
Tyler McKenzie | 8c683ad7dd | |
Jonathan Quigley | 8a94129687 | |
Jonathan Quigley | f830629df4 |
|
@ -0,0 +1,8 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
|
@ -0,0 +1,57 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<HTMLCodeStyleSettings>
|
||||
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
||||
</HTMLCodeStyleSettings>
|
||||
<JSCodeStyleSettings version="0">
|
||||
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
||||
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
||||
<option name="FORCE_QUOTE_STYlE" value="true" />
|
||||
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
|
||||
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
||||
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
||||
</JSCodeStyleSettings>
|
||||
<TypeScriptCodeStyleSettings version="0">
|
||||
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
||||
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
||||
<option name="FORCE_QUOTE_STYlE" value="true" />
|
||||
<option name="ENFORCE_TRAILING_COMMA" value="Remove" />
|
||||
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
||||
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
||||
</TypeScriptCodeStyleSettings>
|
||||
<VueCodeStyleSettings>
|
||||
<option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
|
||||
<option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
|
||||
</VueCodeStyleSettings>
|
||||
<codeStyleSettings language="HTML">
|
||||
<option name="SOFT_MARGINS" value="80" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="JavaScript">
|
||||
<option name="SOFT_MARGINS" value="80" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="TypeScript">
|
||||
<option name="SOFT_MARGINS" value="80" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="Vue">
|
||||
<option name="SOFT_MARGINS" value="80" />
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
|
@ -0,0 +1,5 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
</state>
|
||||
</component>
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="PyDocumentationSettings">
|
||||
<option name="format" value="PLAIN" />
|
||||
<option name="myDocStringFormat" value="Plain" />
|
||||
</component>
|
||||
<component name="TemplatesService">
|
||||
<option name="TEMPLATE_CONFIGURATION" value="Jinja2" />
|
||||
<option name="TEMPLATE_FOLDERS">
|
||||
<list>
|
||||
<option value="$MODULE_DIR$/datasette/templates" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="TestRunnerService">
|
||||
<option name="PROJECT_TEST_RUNNER" value="py.test" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,6 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.8 (datasette) (2)" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (datasette) (2)" project-jdk-type="Python SDK" />
|
||||
</project>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/datasette.iml" filepath="$PROJECT_DIR$/.idea/datasette.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -1553,7 +1553,7 @@ class Datasette:
|
|||
return self.get_database(route=database_route)
|
||||
except KeyError:
|
||||
raise DatabaseNotFound(
|
||||
"Database not found: {}".format(database_route), database_route
|
||||
"Invalid Database: The database {} was not found. Return to the previous page below to ensure your own Database was created properly.".format(database_route), database_route
|
||||
)
|
||||
|
||||
async def resolve_table(self, request):
|
||||
|
@ -1566,7 +1566,7 @@ class Datasette:
|
|||
is_view = await db.view_exists(table_name)
|
||||
if not (table_exists or is_view):
|
||||
raise TableNotFound(
|
||||
"Table not found: {}".format(table_name), db.name, table_name
|
||||
"Invalid Table: {} was not found. Return to the previous page below, table is not present within the Database file.".format(table_name), db.name, table_name
|
||||
)
|
||||
return ResolvedTable(db, table_name, is_view)
|
||||
|
||||
|
@ -1578,7 +1578,7 @@ class Datasette:
|
|||
row = results.first()
|
||||
if row is None:
|
||||
raise RowNotFound(
|
||||
"Row not found: {}".format(pk_values), db.name, table_name, pk_values
|
||||
"Invalid Row: The row id {} is invalid on the table. It may be spelled incorrectly or not present on the table, use the button below to go back.".format(pk_values), db.name, table_name, pk_values
|
||||
)
|
||||
return ResolvedRow(db, table_name, sql, params, pks, pk_values, results.first())
|
||||
|
||||
|
|
|
@ -576,7 +576,7 @@ def serve(
|
|||
)
|
||||
|
||||
# if files is a single directory, use that as config_dir=
|
||||
if 1 == len(files) and os.path.isdir(files[0]):
|
||||
if 2 == len(files) and os.path.isdir(files[0]):
|
||||
kwargs["config_dir"] = pathlib.Path(files[0])
|
||||
files = []
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ from .utils import (
|
|||
table_columns,
|
||||
table_column_details,
|
||||
)
|
||||
from .inspect import inspect_hash
|
||||
from .my_inspect import inspect_hash
|
||||
|
||||
connections = threading.local()
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import hashlib
|
||||
|
||||
from .utils import (
|
||||
from datasette.utils import (
|
||||
detect_spatialite,
|
||||
detect_fts,
|
||||
detect_primary_keys,
|
|
@ -1,11 +1,10 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{% if title %}{{ title }}{% else %}Error {{ status }}{% endif %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>{% if title %}{{ title }}{% else %}Error {{ status }}{% endif %}</h1>
|
||||
|
||||
<div style="padding: 1em; margin: 1em 0; border: 3px solid red;">{{ error }}</div>
|
||||
|
||||
<a href="javascript:window.history.back();">Return to Previous</a>
|
||||
{% endblock %}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
|
@ -0,0 +1,6 @@
|
|||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (pythonProject)" project-jdk-type="Python SDK" />
|
||||
</project>
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/pythonProject.iml" filepath="$PROJECT_DIR$/.idea/pythonProject.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -133,14 +133,14 @@ async def test_insert_rows(ds_write, return_rows):
|
|||
{},
|
||||
None,
|
||||
404,
|
||||
["Database not found: data2"],
|
||||
["Invalid Database: The database data2 was not found. Return to the previous page below to ensure your own Database was created properly."],
|
||||
),
|
||||
(
|
||||
"/data/docs2/-/insert",
|
||||
{},
|
||||
None,
|
||||
404,
|
||||
["Table not found: docs2"],
|
||||
["Invalid Table: docs2 was not found. Return to the previous page below, table is not present within the Database file."],
|
||||
),
|
||||
(
|
||||
"/data/docs/-/insert",
|
||||
|
@ -274,7 +274,7 @@ async def test_insert_rows(ds_write, return_rows):
|
|||
{"rows": [{"title": "Test"}]},
|
||||
None,
|
||||
404,
|
||||
["Table not found: badtable"],
|
||||
["Invalid Table: badtable was not found. Return to the previous page below, table is not present within the Database file."],
|
||||
),
|
||||
# missing primary key
|
||||
(
|
||||
|
@ -598,7 +598,7 @@ async def test_delete_row_errors(ds_write, scenario):
|
|||
assert (
|
||||
response.json()["errors"] == ["Permission denied"]
|
||||
if scenario == "no_token"
|
||||
else ["Table not found: bad_table"]
|
||||
else ["Invalid Table: bad_table was not found. Return to the previous page below, table is not present within the Database file."]
|
||||
)
|
||||
assert len((await ds_write.client.get("/data/docs.json?_shape=array")).json()) == 1
|
||||
|
||||
|
@ -703,7 +703,7 @@ async def test_update_row_check_permission(ds_write, scenario):
|
|||
assert (
|
||||
response.json()["errors"] == ["Permission denied"]
|
||||
if scenario == "no_token"
|
||||
else ["Table not found: bad_table"]
|
||||
else ["Invalid Table: bad_table was not found. Return to the previous page below, table is not present within the Database file."]
|
||||
)
|
||||
|
||||
|
||||
|
@ -830,7 +830,7 @@ async def test_drop_table(ds_write, scenario):
|
|||
assert response.json()["ok"] is False
|
||||
expected_error = "Permission denied"
|
||||
if scenario == "bad_table":
|
||||
expected_error = "Table not found: bad_table"
|
||||
expected_error = "Invalid Table: bad_table was not found. Return to the previous page below, table is not present within the Database file."
|
||||
elif scenario == "immutable":
|
||||
expected_error = "Database is immutable"
|
||||
assert response.json()["errors"] == [expected_error]
|
||||
|
|
|
@ -36,7 +36,7 @@ async def test_table_json(ds_client):
|
|||
async def test_table_not_exists_json(ds_client):
|
||||
assert (await ds_client.get("/fixtures/blah.json")).json() == {
|
||||
"ok": False,
|
||||
"error": "Table not found: blah",
|
||||
"error": "Invalid Table: blah was not found. Return to the previous page below, table is not present within the Database file.",
|
||||
"status": 404,
|
||||
"title": None,
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue