Row count fix + sort index page databases alphabetically

Sorting alphabetically should fix a test failure in Python 3.5

Refs #460
This commit is contained in:
Simon Willison 2019-05-15 17:40:10 -07:00
commit 79303163b2
2 changed files with 9 additions and 6 deletions

View file

@ -73,7 +73,7 @@ class IndexView(RenderMixin):
"tables_and_views_more": (len(visible_tables) + len(views))
> TRUNCATE_AT,
"tables_count": len(visible_tables),
"table_rows_sum": sum((t["count"] or 0) for t in tables.values()),
"table_rows_sum": sum((t["count"] or 0) for t in visible_tables),
"hidden_table_rows_sum": sum(
t["count"] for t in hidden_tables if t["count"] is not None
),
@ -81,6 +81,9 @@ class IndexView(RenderMixin):
"views_count": len(views),
}
)
databases.sort(key=lambda database: database["name"])
if as_format:
headers = {}
if self.ds.cors: