Porównaj commity

...

7 Commity

Autor SHA1 Wiadomość Data
Timothy O'Leary c570deafd9
Merge c701a64da2 into 7d6d471dc5 2024-04-18 22:43:12 +00:00
Ian Chartier c701a64da2 Group issue 2: 2123 fix?
Changed a minor value in the --reload command
2024-04-18 18:42:42 -04:00
Tyler McKenzie a0577796da updated pytest error messages
tests for the error 404 for rows not found yet
2024-04-02 17:21:53 -04:00
Tyler McKenzie 77392cf62c Foreign key errors more descriptive 2024-04-02 16:40:46 -04:00
Tyler McKenzie 8c683ad7dd Added back button for errors
Added a single href link to the error.html page in datasette/templates. allows users to go back without having to use the browser's back button. temporary fix.
2024-03-27 17:02:03 -04:00
Jonathan Quigley 8a94129687 Merge remote-tracking branch 'origin/main' 2024-03-25 12:20:17 -04:00
Jonathan Quigley f830629df4 fix to work with developer environment 2024-03-25 12:20:02 -04:00
21 zmienionych plików z 178 dodań i 15 usunięć

8
.idea/.gitignore vendored 100644
Wyświetl plik

@ -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

Wyświetl plik

@ -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>

Wyświetl plik

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

Wyświetl plik

@ -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>

Wyświetl plik

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

7
.idea/misc.xml 100644
Wyświetl plik

@ -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>

Wyświetl plik

@ -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>

6
.idea/vcs.xml 100644
Wyświetl plik

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

Wyświetl plik

@ -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())

Wyświetl plik

@ -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 = []

Wyświetl plik

@ -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()

Wyświetl plik

@ -1,6 +1,6 @@
import hashlib
from .utils import (
from datasette.utils import (
detect_spatialite,
detect_fts,
detect_primary_keys,

Wyświetl plik

@ -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 %}

8
pythonProject/.idea/.gitignore vendored 100644
Wyświetl plik

@ -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

Wyświetl plik

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

Wyświetl plik

@ -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>

Wyświetl plik

@ -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>

Wyświetl plik

@ -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>

Wyświetl plik

@ -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>

Wyświetl plik

@ -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]

Wyświetl plik

@ -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,
}