Skip to content

SG-35529 Minor code refactoring: Clarify the use of _build_opener in download_attachment - #343

Merged
julien-lang merged 2 commits into
masterfrom
julien/refactoring-25-05
Jun 6, 2024
Merged

julien-lang merged 2 commits into
masterfrom
julien/refactoring-25-05

Conversation

@julien-lang

@julien-lang julien-lang commented May 31, 2024 •

Copy link
Copy Markdown
Member

Clarify the use of _build_opener in download_attachment

Before this change, download_attachment indirectly used _build_opener by calling
set_up_auth_cookie. This was misleading because the name of the function, set_up_auth_cookie, does not indicate that it will return a request handler object.

Since set_up_auth_cookie is only used by download_attachment, I suggest this small refactoring making download_attachment directly call _build_opener with an optional cookie handler if necessary.

This PR renames/transforms the set_up_auth_cookie function to get_auth_cookie_handler.

@julien-lang julien-lang changed the title Minor code refactoring: make download_attachment directly use _build_opener SG-35529 Minor code refactoring: make download_attachment directly use _build_opener May 31, 2024
@julien-lang julien-lang changed the title SG-35529 Minor code refactoring: make download_attachment directly use _build_opener SG-35529 Minor code refactoring: Clarify the use of _build_opener in download_attachment Jun 3, 2024
@julien-lang
julien-lang marked this pull request as ready for review June 3, 2024 21:49

@carlos-villavicencio-adsk carlos-villavicencio-adsk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@julien-lang
julien-lang merged commit 0323312 into master Jun 6, 2024
@julien-lang
julien-lang deleted the julien/refactoring-25-05 branch June 6, 2024 17:14
@herronelou

Copy link
Copy Markdown

For what it's worth a year after the battle:
We were using set_up_auth_cookie (it's wasn't marked as a private function) in our code, and pulling the latest version caused a few issues with it now renamed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants