##// END OF EJS Templates
clear signature db on reset
Min RK -
Show More
@@ -354,7 +354,7 b' class NotebookNotary(LoggingConfigurable):'
354 trust_flags = {
354 trust_flags = {
355 'reset' : (
355 'reset' : (
356 {'TrustNotebookApp' : { 'reset' : True}},
356 {'TrustNotebookApp' : { 'reset' : True}},
357 """Generate a new key for notebook signature.
357 """Delete the trusted notebook cache.
358 All previously signed notebooks will become untrusted.
358 All previously signed notebooks will become untrusted.
359 """
359 """
360 ),
360 ),
@@ -383,7 +383,7 b' class TrustNotebookApp(BaseIPythonApplication):'
383 flags = trust_flags
383 flags = trust_flags
384
384
385 reset = Bool(False, config=True,
385 reset = Bool(False, config=True,
386 help="""If True, generate a new key for notebook signature.
386 help="""If True, delete the trusted signature cache.
387 After reset, all previously signed notebooks will become untrusted.
387 After reset, all previously signed notebooks will become untrusted.
388 """
388 """
389 )
389 )
@@ -413,6 +413,9 b' class TrustNotebookApp(BaseIPythonApplication):'
413
413
414 def start(self):
414 def start(self):
415 if self.reset:
415 if self.reset:
416 if os.path.exists(self.notary.db_file):
417 print("Removing trusted signature cache: %s" % self.notary.db_file)
418 os.remove(self.notary.db_file)
416 self.generate_new_key()
419 self.generate_new_key()
417 return
420 return
418 if not self.extra_args:
421 if not self.extra_args:
@@ -16,9 +16,9 b' class TestNotary(TestsBase):'
16
16
17 def setUp(self):
17 def setUp(self):
18 self.notary = sign.NotebookNotary(
18 self.notary = sign.NotebookNotary(
19 db_file=':memory:',
19 secret=b'secret',
20 secret=b'secret',
20 profile_dir=get_ipython().profile_dir,
21 profile_dir=get_ipython().profile_dir,
21 db_file=':memory:'
22 )
22 )
23 with self.fopen(u'test3.ipynb', u'r') as f:
23 with self.fopen(u'test3.ipynb', u'r') as f:
24 self.nb = read(f, as_version=4)
24 self.nb = read(f, as_version=4)
General Comments 0
You need to be logged in to leave comments. Login now