Skip to content

Commit

Permalink
fix: line too long errors
Browse files Browse the repository at this point in the history
  • Loading branch information
KristinAoki committed Oct 30, 2024
1 parent d45a3b1 commit 6801257
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion lms/djangoapps/courseware/views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1573,7 +1573,11 @@ def render_xblock(request, usage_key_string, check_if_enrolled=True, disable_sta
is_preview = request.GET.get('preview', '0') == '1'

store = modulestore()
branch_type = ModuleStoreEnum.Branch.draft_preferred if is_preview and staff_access else ModuleStoreEnum.Branch.published_only
branch_type = (
ModuleStoreEnum.Branch.draft_preferred
) if is_preview and staff_access else (
ModuleStoreEnum.Branch.published_only
)

with store.bulk_operations(course_key):
with store.branch_setting(branch_type, course_key):
Expand Down
8 changes: 6 additions & 2 deletions openedx/core/djangoapps/courseware_api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ def get(self, request, usage_key_string, *args, **kwargs): # lint-amnesty, pyli
usage_key = UsageKey.from_string(usage_key_string)
except InvalidKeyError as exc:
raise NotFound(f"Invalid usage key: '{usage_key_string}'.") from exc

staff_access = has_access(request.user, 'staff', usage_key.course_key)
is_preview = request.GET.get('preview', '0') == '1'
_, request.user = setup_masquerade(
Expand All @@ -605,7 +605,11 @@ def get(self, request, usage_key_string, *args, **kwargs): # lint-amnesty, pyli
reset_masquerade_data=True,
)

branch_type = ModuleStoreEnum.Branch.draft_preferred if is_preview and has_access else ModuleStoreEnum.Branch.published_only
branch_type = (
ModuleStoreEnum.Branch.draft_preferred
) if is_preview and staff_access else (
ModuleStoreEnum.Branch.published_only
)

with modulestore().branch_setting(branch_type, usage_key.course_key):
sequence, _ = get_block_by_usage_id(
Expand Down

0 comments on commit 6801257

Please sign in to comment.