Commit 6488f71d authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

py2/py3: string.letters is locale-dependent and removed in Python 3.

parent 885b3f37
......@@ -6,4 +6,4 @@ import string
import random
return str(DateTime().millis()) + '-' + ''.join(random.sample(string.letters+string.digits, random.randint(min_len,max_len)))
return str(DateTime().millis()) + '-' + ''.join(random.sample(string.ascii_letters+string.digits, random.randint(min_len,max_len)))
return ''.join(random.SystemRandom().sample(string.letters + string.digits, length))
return ''.join(random.SystemRandom().sample(string.ascii_letters + string.digits, length))
......@@ -3,4 +3,4 @@
"""
from random import choice
import string
return ''.join([choice(string.letters) for i in range(max_long)])
return ''.join([choice(string.ascii_letters) for i in range(max_long)])
......@@ -536,7 +536,7 @@ class TestCommerce(ERP5TypeTestCase):
id_string = self.getPortal().Base_generateSessionID()
self.assertEqual(10, len(id_string))
for caracter in id_string:
self.assertTrue(caracter in string.letters)
self.assertTrue(caracter in string.ascii_letters)
id_string = self.getPortal().Base_generateSessionID(max_long=20)
self.assertEqual(20, len(id_string))
......
......@@ -18,7 +18,7 @@ if user_quantity is None:
"error_message": "Parameter 'user_quantity' is required.",
"password" : None })
password = ''.join(random.choice(string.digits + string.letters) for i in xrange(10))
password = ''.join(random.choice(string.digits + string.ascii_letters) for i in xrange(10))
# check erp5_scalability_test business template is present
configurator = portal.business_configuration_module.default_standard_configuration
......
......@@ -3,4 +3,4 @@
"""
from random import choice
import string
return ''.join([choice(string.letters) for i in range(max_long)])
return ''.join([choice(string.ascii_letters) for i in range(max_long)])
......@@ -248,7 +248,7 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase):
def newPassword(self):
""" Generate a password """
return ''.join(random.SystemRandom().sample(string.letters + string.digits, 20))
return ''.join(random.SystemRandom().sample(string.ascii_letters + string.digits, 20))
def login(self, user_name='ERP5TypeTestCase', quiet=0):
"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment