##// END OF EJS Templates
Python 3 renamed hashlib.algorithms to algorithms_guaranteed
MinRK -
Show More
@@ -27,7 +27,11 b' from .current import read, write'
27 #-----------------------------------------------------------------------------
27 #-----------------------------------------------------------------------------
28 # Code
28 # Code
29 #-----------------------------------------------------------------------------
29 #-----------------------------------------------------------------------------
30
30 try:
31 # Python 3
32 algorithms = hashlib.algorithms_guaranteed
33 except AttributeError:
34 algorithms = hashlib.algorithms
31
35
32 def yield_everything(obj):
36 def yield_everything(obj):
33 """Yield every item in a container as bytes
37 """Yield every item in a container as bytes
@@ -83,7 +87,7 b' class NotebookNotary(LoggingConfigurable):'
83 app.initialize()
87 app.initialize()
84 return app.profile_dir
88 return app.profile_dir
85
89
86 algorithm = Enum(hashlib.algorithms, default_value='sha256', config=True,
90 algorithm = Enum(algorithms, default_value='sha256', config=True,
87 help="""The hashing algorithm used to sign notebooks."""
91 help="""The hashing algorithm used to sign notebooks."""
88 )
92 )
89 def _algorithm_changed(self, name, old, new):
93 def _algorithm_changed(self, name, old, new):
@@ -10,8 +10,6 b''
10 # Imports
10 # Imports
11 #-----------------------------------------------------------------------------
11 #-----------------------------------------------------------------------------
12
12
13 import hashlib
14
15 from .. import sign
13 from .. import sign
16 from .base import TestsBase
14 from .base import TestsBase
17
15
@@ -34,7 +32,7 b' class TestNotary(TestsBase):'
34
32
35 def test_algorithms(self):
33 def test_algorithms(self):
36 last_sig = ''
34 last_sig = ''
37 for algo in hashlib.algorithms:
35 for algo in sign.algorithms:
38 self.notary.algorithm = algo
36 self.notary.algorithm = algo
39 self.notary.sign(self.nb)
37 self.notary.sign(self.nb)
40 sig = self.nb.metadata.signature
38 sig = self.nb.metadata.signature
General Comments 0
You need to be logged in to leave comments. Login now