Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ckanext/resource_docs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@ def get(self, package_id: str, resource_id: str) -> str:
)

pkg_dict = tk.get_action("package_show")({}, {"id": package_id})
resource = tk.get_action("resource_show")({}, {"id": resource_id})

except (tk.ObjectNotFound, tk.NotAuthorized):
return tk.abort(404, tk._("Resource not found"))

resources = {res["id"]: res for res in pkg_dict.get("resources", [])}
resource = resources.get(resource_id)

if not resource:
return tk.abort(404, tk._("Resource not found"))

try:
docs = tk.get_action("resource_docs_show")({}, {"resource_id": resource_id})
except tk.ObjectNotFound:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "ckanext-resource-docs"
version = "0.4.2"
version = "0.4.3"
description = "A CKAN extension that lets you attach a flexible, schema-free data dictionary (“resource documentation”) to any resource, not just Datastore-backed ones."
readme = "README.md"
authors = [{ name = "Oleksandr Cherniavskiy", email = "[email protected]" }]
Expand Down