TypeError: 'float' object cannot be interpreted as an integer

This commit is contained in:
Hossein Shafagh 2020-09-18 17:42:28 -07:00
parent c892cd5ae1
commit 21e9a4508d
2 changed files with 8 additions and 8 deletions

View File

@ -11,10 +11,10 @@ debug = os.environ.get("DEBUG") == "True"
def get_random_secret(length): def get_random_secret(length):
secret_key = ''.join(random.choice(string.ascii_uppercase) for x in range(length/4)) secret_key = ''.join(random.choice(string.ascii_uppercase) for x in range(round(length/4)))
secret_key = secret_key + ''.join(random.choice("~!@#$%^&*()_+") for x in range(length/4)) secret_key = secret_key + ''.join(random.choice("~!@#$%^&*()_+") for x in range(round(length/4)))
secret_key = secret_key + ''.join(random.choice(string.ascii_lowercase) for x in range(length/4)) secret_key = secret_key + ''.join(random.choice(string.ascii_lowercase) for x in range(round(length/4)))
return secret_key + ''.join(random.choice(string.digits) for x in range(length/4)) return secret_key + ''.join(random.choice(string.digits) for x in range(round(length/4)))
SECRET_KEY = repr(os.environ.get('SECRET_KEY', get_random_secret(32).encode('utf8'))) SECRET_KEY = repr(os.environ.get('SECRET_KEY', get_random_secret(32).encode('utf8')))

View File

@ -10,10 +10,10 @@ _basedir = os.path.abspath(os.path.dirname(__file__))
# generate random secrets for unittest # generate random secrets for unittest
def get_random_secret(length): def get_random_secret(length):
secret_key = ''.join(random.choice(string.ascii_uppercase) for x in range(length/4)) secret_key = ''.join(random.choice(string.ascii_uppercase) for x in range(round(length/4)))
secret_key = secret_key + ''.join(random.choice("~!@#$%^&*()_+") for x in range(length/4)) secret_key = secret_key + ''.join(random.choice("~!@#$%^&*()_+") for x in range(round(length/4)))
secret_key = secret_key + ''.join(random.choice(string.ascii_lowercase) for x in range(length/4)) secret_key = secret_key + ''.join(random.choice(string.ascii_lowercase) for x in range(round(length/4)))
return secret_key + ''.join(random.choice(string.digits) for x in range(length/4)) return secret_key + ''.join(random.choice(string.digits) for x in range(round(length/4)))
THREADS_PER_PAGE = 8 THREADS_PER_PAGE = 8