Renamed datasette.config() to .setting(), closes #1107

This commit is contained in:
Simon Willison 2020-11-24 14:06:32 -08:00
commit f2e2bfcdd9
10 changed files with 86 additions and 60 deletions

View file

@ -136,7 +136,7 @@ class DatabaseView(DataView):
"show_hidden": request.args.get("_show_hidden"),
"editable": True,
"metadata": metadata,
"allow_download": self.ds.config("allow_download")
"allow_download": self.ds.setting("allow_download")
and not db.is_mutable
and database != ":memory:",
},
@ -161,7 +161,7 @@ class DatabaseDownload(DataView):
db = self.ds.databases[database]
if db.is_memory:
raise DatasetteError("Cannot download :memory: database", status=404)
if not self.ds.config("allow_download") or db.is_mutable:
if not self.ds.setting("allow_download") or db.is_mutable:
raise Forbidden("Database download is forbidden")
if not db.path:
raise DatasetteError("Cannot download database", status=404)