mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
Generate a small random size when necessary
This commit is contained in:
parent
aa98a5b5e1
commit
4f5909ad21
@ -276,13 +276,14 @@ def random_utf8(*args, **kwargs):
|
||||
|
||||
|
||||
def random_title(num_words=2, non_ascii=True):
|
||||
if os.getenv('AWXKIT_FORCE_ONLY_ASCII', False):
|
||||
non_ascii = False
|
||||
base = ''.join([random.choice(words) for word in range(num_words)])
|
||||
if non_ascii:
|
||||
title = ''.join([base, random_utf8(1)])
|
||||
if os.getenv('AWXKIT_FORCE_ONLY_ASCII', False):
|
||||
title = ''.join([base, ''.join(str(random_int(99)))])
|
||||
else:
|
||||
title = ''.join([base, ''.join([str(random_int()) for _ in range(3)])])
|
||||
if non_ascii:
|
||||
title = ''.join([base, random_utf8(1)])
|
||||
else:
|
||||
title = ''.join([base, ''.join([str(random_int()) for _ in range(3)])])
|
||||
return title
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user