mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Database/Table views inherit source/license/source_url/license_url metadata
If you set the source_url/license_url/source/license fields in your root metadata those values will now be inherited all the way down to the database and table templates. The title/description are NOT inherited. Also added unit tests for the HTML generated by the metadata. Refs #185
This commit is contained in:
parent
012fc7c5cd
commit
89d9fbb91b
4 changed files with 94 additions and 6 deletions
|
|
@ -16,6 +16,7 @@ def app_client():
|
|||
page_size=50,
|
||||
max_returned_rows=100,
|
||||
sql_time_limit_ms=20,
|
||||
metadata=METADATA,
|
||||
)
|
||||
ds.sqlite_functions.append(
|
||||
('sleep', 1, lambda n: time.sleep(float(n))),
|
||||
|
|
@ -23,6 +24,27 @@ def app_client():
|
|||
yield ds.app().test_client
|
||||
|
||||
|
||||
METADATA = {
|
||||
'title': 'Datasette Title',
|
||||
'description': 'Datasette Description',
|
||||
'license': 'License',
|
||||
'license_url': 'http://www.example.com/license',
|
||||
'source': 'Source',
|
||||
'source_url': 'http://www.example.com/source',
|
||||
'databases': {
|
||||
'test_tables': {
|
||||
'description': 'Test tables description',
|
||||
'tables': {
|
||||
'simple_primary_key': {
|
||||
'description_html': 'Simple <em>primary</em> key',
|
||||
'title': 'This <em>HTML</em> is escaped',
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TABLES = '''
|
||||
CREATE TABLE simple_primary_key (
|
||||
pk varchar(30) primary key,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue