-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Temporary hack to avoid name collision without renaming the secrets app
- Loading branch information
1 parent
01b9d1a
commit f1b0421
Showing
1 changed file
with
11 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# TODO: Rename the secrets app, probably | ||
# Python 3.6 introduced a standard library named "secrets," which obviously conflicts with this Django app. To avoid | ||
# renaming the app, we hotwire the components of the standard library that Django calls. (I don't like this any more | ||
# than you do, but it works for now.) The only references to the secrets modules are in django/utils/crypto.py. | ||
# | ||
# First, we copy secrets.compare_digest, which comes from the hmac module: | ||
from hmac import compare_digest | ||
|
||
# Then, we instantiate SystemRandom and map its choice() function: | ||
from random import SystemRandom | ||
choice = SystemRandom().choice |