Update rndstr to use string.ascii_letters for py3k
Python3 has eliminated string.letters, and also makes dealing with arrays of bytes somewhat tricky. Luckily string.ascii_letters returns str.
This commit is contained in:
@@ -164,8 +164,8 @@ def rndstr(size=16, alphabet=""):
|
|||||||
"""
|
"""
|
||||||
rng = random.SystemRandom()
|
rng = random.SystemRandom()
|
||||||
if not alphabet:
|
if not alphabet:
|
||||||
alphabet = string.letters[0:52] + string.digits
|
alphabet = string.ascii_letters[0:52] + string.digits
|
||||||
return str().join(rng.choice(alphabet) for _ in range(size))
|
return type(alphabet)().join(rng.choice(alphabet) for _ in range(size))
|
||||||
|
|
||||||
|
|
||||||
def sid():
|
def sid():
|
||||||
|
Reference in New Issue
Block a user