本文整理汇总了Python中models.Job.by_job_name方法的典型用法代码示例。如果您正苦于以下问题:Python Job.by_job_name方法的具体用法?Python Job.by_job_name怎么用?Python Job.by_job_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Job
的用法示例。
在下文中一共展示了Job.by_job_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import by_job_name [as 别名]
def post(self, *args, **kwargs):
''' Creates a job based on the parameters '''
form = Form(
jobname="Please enter a job name",
algorithm_uuid="Please select an algorithm",
hashes="Please provide the target hashes",
)
if form.validate(self.request.arguments):
algo = Algorithm.by_uuid(self.get_argument('algorithm_uuid'))
user = self.get_current_user()
if algo is None:
self.render('cracking/jobs/create.html',
errors=['Invalid algorithm']
)
elif Job.by_job_name(self.get_argument('jobname')) is not None:
self.render('cracking/jobs/create.html',
errors=['Duplicate job name']
)
else:
job = self.create_job(user, algo)
dispatch = Dispatch.Instance()
dispatch.refresh()
self.render("cracking/jobs/created.html", job=job)
else:
self.render('cracking/jobs/create.html', errors=form.errors)