We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 01b9d1a commit f1b0421Copy full SHA for f1b0421
netbox/secrets/__init__.py
@@ -0,0 +1,11 @@
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
+
9
+# Then, we instantiate SystemRandom and map its choice() function:
10
+from random import SystemRandom
11
+choice = SystemRandom().choice
0 commit comments