__init__.py 627 B

1234567891011
  1. # TODO: Rename the secrets app, probably
  2. # Python 3.6 introduced a standard library named "secrets," which obviously conflicts with this Django app. To avoid
  3. # renaming the app, we hotwire the components of the standard library that Django calls. (I don't like this any more
  4. # than you do, but it works for now.) The only references to the secrets modules are in django/utils/crypto.py.
  5. #
  6. # First, we copy secrets.compare_digest, which comes from the hmac module:
  7. from hmac import compare_digest
  8. # Then, we instantiate SystemRandom and map its choice() function:
  9. from random import SystemRandom
  10. choice = SystemRandom().choice