Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def sentence(cls, locale=Locales.EN):
return Text(locale).sentence()
def t1(self, seed):
return Text(seed=seed)
def t2(self, seed):
return Text(seed=seed)
def create_ticket_reply(new_ticket):
t = Text()
new_reply = FlicketPost(
ticket=new_ticket,
content=t.text(randint(3, 15)),
user=get_random_user(),
date_added=datetime.datetime.now()
)
new_reply.user.total_posts += 1
db.session.add(new_reply)
for token in token_list:
person = mimesis.Person()
if token == 'I':
values.append(i)
if token == 'L':
data = person.username()
values.append(data)
if token == 'E':
data = person.email()
values.append(data)
if token == 'P':
data = person.password()
values.append(data)
if token == 'T':
sample_length = random.randint(1, 10)
data = mimesis.Text().text(quantity=sample_length)
values.append(data)
inserted_data.append(tuple(values))
return inserted_data, token_list
def topic_creation(num_topics_):
# if the number of topics is already satisfied don't add any more.
topic_count = FlicketTicket.query.count()
if topic_count >= num_topics_:
print('Topic number already satisfied')
return
else:
num_topics_ = num_topics_ - topic_count
for i in range(topic_count, num_topics_):
t = Text()
new_ticket = FlicketTicket(
title=t.title()[0:field_size['title_max_length']],
content=t.text(randint(3, 15)),
user=get_random_user(),
date_added=datetime.datetime.now(),
current_status=get_random_status(),
ticket_priority=get_random_priority(),
category=get_random_category(),
assigned=get_random_user()
)
new_ticket.user.total_posts += 1
db.session.add(new_ticket)
mess_1 = "#{}: ticket ....".format(i)