Skip to content

Commit

Permalink
Merge pull request #606 from edly-io/manan/fix-edly-org-exception
Browse files Browse the repository at this point in the history
Fixed preview site getting 500 because of no edly sub org.
  • Loading branch information
manan-memon authored Dec 20, 2024
2 parents ebe8048 + a8c2ba4 commit fae0b3f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions openedx/features/edly/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,19 @@ def get_edly_sub_org_from_request(request):
Returns:
EdlySubOrg: edly_sub_org object
"""
site = getattr(request, 'site', None)
if not site:
LOGGER.info('Request %s has no site', request)
return None
try:
edly_sub_org = request.site.edly_sub_org_for_lms
edly_sub_org = EdlySubOrganization.objects.get(
Q(lms_site=site) |
Q(studio_site=site) |
Q(preview_site=site)
)
except EdlySubOrganization.DoesNotExist:
edly_sub_org = request.site.edly_sub_org_for_studio
LOGGER.info('No Edly sub organization found for site %s', site)
return None

return edly_sub_org

Expand Down

0 comments on commit fae0b3f

Please sign in to comment.