diff --git a/datasette/app.py b/datasette/app.py index cdfcb11d..c73c0fe0 100644 --- a/datasette/app.py +++ b/datasette/app.py @@ -27,6 +27,7 @@ from .views.table import RowView, TableView from .utils import ( InterruptedError, Results, + encode_table_name, escape_css_string, escape_sqlite, get_plugins, @@ -465,6 +466,7 @@ class Datasette: self.jinja_env = Environment(loader=template_loader, autoescape=True) self.jinja_env.filters["escape_css_string"] = escape_css_string self.jinja_env.filters["quote_plus"] = lambda u: urllib.parse.quote_plus(u) + self.jinja_env.filters["encode_table_name"] = encode_table_name self.jinja_env.filters["escape_sqlite"] = escape_sqlite self.jinja_env.filters["to_css_class"] = to_css_class pm.hook.prepare_jinja2_environment(env=self.jinja_env) diff --git a/datasette/publish/now.py b/datasette/publish/now.py index 92654b68..3cc657fa 100644 --- a/datasette/publish/now.py +++ b/datasette/publish/now.py @@ -21,7 +21,8 @@ def publish_subcommand(publish): help="Application name to use when deploying", ) @click.option("--force", is_flag=True, help="Pass --force option to now") - @click.option("--token", help="Auth token to use for deploy (Now only)") + @click.option("--token", help="Auth token to use for deploy") + @click.option("--alias", help="Desired alias e.g. yoursite.now.sh") @click.option("--spatialite", is_flag=True, help="Enable SpatialLite extension") def now( files, @@ -41,6 +42,7 @@ def publish_subcommand(publish): name, force, token, + alias, spatialite, ): fail_if_publish_binary_not_installed("now", "Zeit Now", "https://zeit.co/now") @@ -70,11 +72,12 @@ def publish_subcommand(publish): "source_url": source_url, }, ): - open("now.json", "w").write(json.dumps({ - "features": { - "cloud": "v1" - } - })) + now_json = { + "version": 1 + } + if alias: + now_json["alias"] = alias + open("now.json", "w").write(json.dumps(now_json)) args = [] if force: args.append("--force") @@ -84,3 +87,5 @@ def publish_subcommand(publish): call(["now"] + args) else: call("now") + if alias: + call(["now", "alias"]) diff --git a/datasette/templates/database.html b/datasette/templates/database.html index 05acff84..9c581656 100644 --- a/datasette/templates/database.html +++ b/datasette/templates/database.html @@ -27,7 +27,7 @@ {% for table in tables %} {% if show_hidden or not table.hidden %}
{% for column in table.columns[:9] %}{{ column }}{% if not loop.last %}, {% endif %}{% endfor %}{% if table.columns|length > 9 %}...{% endif %}
{{ "{:,}".format(table.count) }} row{% if table.count == 1 %}{% else %}s{% endif %}
{% for table in database.tables_truncated %}{{ table.name }}{% if not loop.last %}, {% endif %}{% endfor %}{% if database.tables_more %}, ...{% endif %}
+{% for table in database.tables_truncated %}{{ table.name }}{% if not loop.last %}, {% endif %}{% endfor %}{% if database.tables_more %}, ...{% endif %}
{% endfor %} {% endblock %} diff --git a/datasette/templates/row.html b/datasette/templates/row.html index 4ef0b758..df81899f 100644 --- a/datasette/templates/row.html +++ b/datasette/templates/row.html @@ -16,7 +16,7 @@ {% block body_class %}row db-{{ database|to_css_class }} table-{{ table|to_css_class }}{% endblock %} {% block content %} - +