Skip to content

Release 0.137.12#3273

Closed
odlbot wants to merge 11 commits intoreleasefrom
release-candidate
Closed

Release 0.137.12#3273
odlbot wants to merge 11 commits intoreleasefrom
release-candidate

Conversation

@odlbot
Copy link
Contributor

@odlbot odlbot commented Feb 5, 2026

James Kachel

Nathan Levesque

renovate[bot]

renovate bot and others added 11 commits February 4, 2026 10:44
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@github-actions
Copy link

github-actions bot commented Feb 5, 2026

OpenAPI Changes

Show/hide ## Changes for v0.yaml:
## Changes for v0.yaml:
1 changes: 0 error, 1 warning, 0 info
warning	[response-property-enum-value-added] at head/openapi/specs/v0.yaml	
	in API POST /api/v0/b2b/enroll/{readable_id}/
		added the new 'b2b-error-not-enrollable' enum value to the 'result/allOf[#/components/schemas/ResultEnum]/' response property for the response status '200'
		Adding new enum values to response could be unexpected for clients, use x-extensible-enum instead.



## Changes for v1.yaml:
1 changes: 0 error, 1 warning, 0 info
warning	[response-property-enum-value-added] at head/openapi/specs/v1.yaml	
	in API POST /api/v0/b2b/enroll/{readable_id}/
		added the new 'b2b-error-not-enrollable' enum value to the 'result/allOf[#/components/schemas/ResultEnum]/' response property for the response status '200'
		Adding new enum values to response could be unexpected for clients, use x-extensible-enum instead.



## Changes for v2.yaml:
1 changes: 0 error, 1 warning, 0 info
warning	[response-property-enum-value-added] at head/openapi/specs/v2.yaml	
	in API POST /api/v0/b2b/enroll/{readable_id}/
		added the new 'b2b-error-not-enrollable' enum value to the 'result/allOf[#/components/schemas/ResultEnum]/' response property for the response status '200'
		Adding new enum values to response could be unexpected for clients, use x-extensible-enum instead.



Unexpected changes? Ensure your branch is up-to-date with main (consider rebasing).

Comment on lines 338 to +348
user = self.request.user
if qp.get("org_id"):
added_context["org_id"] = qp.get("org_id")
added_context["user_contracts"] = (
(
user.b2b_contracts.filter(
organization__pk=added_context["org_id"]
)
.values_list("id", flat=True)
.all()
)
Copy link

Choose a reason for hiding this comment

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

Bug: The retrieve_by_readable_id view action does not handle the DoesNotExist exception, causing a 500 error if a course is not found.
Severity: MEDIUM

Suggested Fix

Use get_object_or_404 from django.shortcuts instead of .get(). This will automatically handle the DoesNotExist case by returning a 404 Not Found response. Alternatively, wrap the .get() call in a try...except Course.DoesNotExist block and manually return a Response with a 404 status.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: courses/views/v2/__init__.py#L336-L348

Potential issue: The `retrieve_by_readable_id` view action uses
`self.get_queryset().get(readable_id=readable_id)` to fetch a course. If a `readable_id`
is provided that does not match any existing course, the `.get()` method will raise a
`Course.DoesNotExist` exception. Since this exception is not handled within the view, it
will propagate up and result in a 500 Internal Server Error response for the client,
instead of a more appropriate 404 Not Found.

Did we get this right? 👍 / 👎 to inform future reviews.

@rhysyngsun rhysyngsun closed this Feb 5, 2026
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.

3 participants