Skip to content

Commit 317a975

Browse files
committed
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.
1 parent dc65c85 commit 317a975

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/saml2/s_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ def rndstr(size=16, alphabet=""):
164164
"""
165165
rng = random.SystemRandom()
166166
if not alphabet:
167-
alphabet = string.letters[0:52] + string.digits
168-
return str().join(rng.choice(alphabet) for _ in range(size))
167+
alphabet = string.ascii_letters[0:52] + string.digits
168+
return type(alphabet)().join(rng.choice(alphabet) for _ in range(size))
169169

170170

171171
def sid():

0 commit comments

Comments
 (0)