Skip to content

Commit

Permalink
Ensure access to current_user only when self.request exists
Browse files Browse the repository at this point in the history
  • Loading branch information
devxpy committed Jul 25, 2024
1 parent 6a1b0d5 commit 18cfcce
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion recipes/DocSearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def run_v2(
"search_query": response.final_search_query,
},
),
current_user=self.request.user,
current_user=self.request and self.request.user,
)

# empty search result, abort!
Expand Down
2 changes: 1 addition & 1 deletion recipes/GoogleGPT.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def run_v2(
},
),
is_user_url=False,
current_user=self.request.user,
current_user=self.request and self.request.user,
)
# add pretty titles to references
for ref in response.references:
Expand Down
2 changes: 1 addition & 1 deletion recipes/VideoBots.py
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ def run_v2(
"keyword_query": response.final_keyword_query,
},
),
current_user=self.request.user,
current_user=self.request and self.request.user,
)
if request.use_url_shortener:
for reference in response.references:
Expand Down

0 comments on commit 18cfcce

Please sign in to comment.