Skip to content

Conversation

jobselko
Copy link
Contributor

@jobselko jobselko commented Sep 4, 2025

closes #625

@jobselko jobselko self-assigned this Sep 4, 2025
@github-actions github-actions bot added no-changelog multi-commit Add to bypass single commit lint check no-issue labels Sep 4, 2025
@jobselko jobselko force-pushed the close_625 branch 2 times, most recently from 16f7486 to 03e61c7 Compare September 8, 2025 21:52
@github-actions github-actions bot removed the multi-commit Add to bypass single commit lint check label Sep 8, 2025
@jobselko jobselko force-pushed the close_625 branch 2 times, most recently from c7e19ec to 6647217 Compare September 8, 2025 22:06
Copy link
Contributor

@gerrod3 gerrod3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR looks like it is coming along well.

Comment on lines 278 to 283
def handle_exception(self, exc):
# todo: fixes test_pull_through_filter?
if isinstance(exc, (Http404, NotFound)):
# Force JSON response since JSONRenderer is not in get_renderers()
return JsonResponse({"detail": str(exc)}, status=404)
return super().handle_exception(exc)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no reason the 404 has to be a JSON response. You could change the test to just check for the error string instead of expecting the result to be json.

PyPISimpleJSONRenderer(),
]
else:
return [JSONRenderer(), BrowsableAPIRenderer()]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does super().get_renders() return these values?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

def write_simple_detail_json(project_name, project_packages):
"""Writes the simple detail page in JSON format."""
files = []
for filename, url, sha256 in project_packages:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make sense to change project_packages to a list of dictionaries, or namedtuples, and then modify the simple_detail template accordingly.

@jobselko jobselko force-pushed the close_625 branch 4 times, most recently from 5f68a09 to 5ad38d9 Compare September 23, 2025 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for new JSON simple index

2 participants