##// END OF EJS Templates
Throw UsageError instead of ValueError.
Stefan van der Walt -
Show More
@@ -6,6 +6,8 b' import hashlib'
6 6 import random
7 7 import getpass
8 8
9 from IPython.core.error import UsageError
10
9 11 # Length of the salt in nr of hex chars, which implies salt_len * 4
10 12 # bits of randomness.
11 13 salt_len = 12
@@ -46,7 +48,7 b" def passwd(passphrase=None, algorithm='sha1'):"
46 48 else:
47 49 print('Passwords do not match.')
48 50 else:
49 raise ValueError('No matching passwords found. Giving up.')
51 raise UsageError('No matching passwords found. Giving up.')
50 52
51 53 h = hashlib.new(algorithm)
52 54 salt = ('%0' + str(salt_len) + 'x') % random.getrandbits(4 * salt_len)
General Comments 0
You need to be logged in to leave comments. Login now