Skip to content

Commit

Permalink
update docstring for prelaunch exception
Browse files Browse the repository at this point in the history
  • Loading branch information
jontsai committed Jun 22, 2024
1 parent e8f0178 commit 7e5225b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/prelaunch/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ def process_request(self, request):
path = request.path

self.early_access_code = get_early_access_code(request)
self.has_early_access = has_early_access(request, early_access_code=self.early_access_code)
self.has_early_access = has_early_access(
request, early_access_code=self.early_access_code
)

should_redirect_to_prelaunch = (
is_prelaunch_mode()
Expand Down
9 changes: 9 additions & 0 deletions apps/prelaunch/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ def is_prelaunch_exception_url(path):


def is_prelaunch_exception_view(path):
"""Determines if the path is an excepted view from prelaunch redirection
This solution is non-ideal because it reverses the view name from a list of view names, which is
not always possible because we do not always have the args and kwargs necessary to reverse the view name.
A preferred approach would be to take as a parameter the `request` object, and check if the view name matches
the `request.resolver_match` object. However, this is not possible because the middleware does not have access
at this point -- the request has not yet been resolved to a view.
"""
is_excepted = False
prelaunch_exception_views = htk_setting('HTK_PRELAUNCH_EXCEPTION_VIEWS')
for view_name in prelaunch_exception_views:
Expand Down

0 comments on commit 7e5225b

Please sign in to comment.