Skip to content

Secret: add a __bool__ implementation#1625

Merged
Kludex merged 1 commit intoKludex:masterfrom
rcoup:rc-secret-bool
May 5, 2022
Merged

Secret: add a __bool__ implementation#1625
Kludex merged 1 commit intoKludex:masterfrom
rcoup:rc-secret-bool

Conversation

@rcoup
Copy link
Contributor

@rcoup rcoup commented May 5, 2022

Allows using a Secrets in a conditional statement to check for empty/None without needing to cast it to a str.

Before:

if str(settings.A_SECRET):  # without the cast it's always True
  # do stuff

After:

if settings.A_SECRET:
  # do stuff

Allows using `if settings.A_SECRET:` to check for empty/None without needing to
cast it to a str.
@Kludex Kludex added the feature New feature or request label May 5, 2022
@Kludex
Copy link
Owner

Kludex commented May 5, 2022

Thanks for the PR @rcoup !

@Kludex Kludex merged commit beb8943 into Kludex:master May 5, 2022
@rcoup rcoup deleted the rc-secret-bool branch May 6, 2022 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants