当前位置: 首页>>代码示例>>Python>>正文


Python Job.put方法代码示例

本文整理汇总了Python中jobs.models.Job.put方法的典型用法代码示例。如果您正苦于以下问题:Python Job.put方法的具体用法?Python Job.put怎么用?Python Job.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jobs.models.Job的用法示例。


在下文中一共展示了Job.put方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_work

# 需要导入模块: from jobs.models import Job [as 别名]
# 或者: from jobs.models.Job import put [as 别名]
 def test_work(self):
     job = Job(job_name='some-job')
     job.put()
     response = self.client.post(reverse('jobs.work'), {
         'job_key': str(job.key()),
         'params': '{}'
     })
     self.assertEqual(response.status_code, 403)
开发者ID:BubbleTouchSoftware,项目名称:chirpradio,代码行数:10,代码来源:tests.py

示例2: test_only_admin_can_access

# 需要导入模块: from jobs.models import Job [as 别名]
# 或者: from jobs.models.Job import put [as 别名]
 def test_only_admin_can_access(self):
     self.client.logout()
     assert self.client.login(email="[email protected]", roles=[roles.DJ])
     r = self.client.post(reverse("jobs.start"), data={"job_name": "build-trafficlog-report"})
     eq_(r.status_code, 403)
     job = Job(job_name="build-trafficlog-report")
     job.put()
     r = self.client.post(reverse("jobs.work"), data={"job_key": job.key(), "params": "{}"})
     eq_(r.status_code, 403)
     r = self.client.post(reverse("jobs.product", args=[str(job.key())]))
     eq_(r.status_code, 403)
开发者ID:chirpradio,项目名称:chirpradio,代码行数:13,代码来源:tests.py

示例3: create

# 需要导入模块: from jobs.models import Job [as 别名]
# 或者: from jobs.models.Job import put [as 别名]
def create(request):
    if request.method == 'POST':
        form = JobForm(request.POST)
        if form.is_valid():
            job = Job(**form.cleaned_data)
            if users.is_current_user_admin():
                job.publish()
            job.put()
            return HttpResponseRedirect('/jobs/my')
    else:
        form = JobForm()
    return _custom_render_to_response('job_form.html', {'form': form, 'title': 'Add new job'})
开发者ID:maxnik,项目名称:jobsforhackers,代码行数:14,代码来源:views.py

示例4: test_only_admin_can_access

# 需要导入模块: from jobs.models import Job [as 别名]
# 或者: from jobs.models.Job import put [as 别名]
 def test_only_admin_can_access(self):
     self.client.logout()
     assert self.client.login(email="[email protected]",
                              roles=[roles.DJ])
     r = self.client.post(reverse('jobs.start'),
                          data={'job_name': 'build-trafficlog-report'})
     eq_(r.status_code, 403)
     job = Job(job_name='build-trafficlog-report')
     job.put()
     r = self.client.post(reverse('jobs.work'),
                          data={'job_key': job.key(),
                                'params': '{}'})
     eq_(r.status_code, 403)
     r = self.client.post(reverse('jobs.product', args=[str(job.key())]))
     eq_(r.status_code, 403)
开发者ID:BubbleTouchSoftware,项目名称:chirpradio,代码行数:17,代码来源:tests.py

示例5: start_job

# 需要导入模块: from jobs.models import Job [as 别名]
# 或者: from jobs.models.Job import put [as 别名]
def start_job(request):
    init_jobs()
    # TODO(kumar) check for already running jobs
    reap_dead_jobs()
    job_name = request.POST['job_name']
    job = Job(job_name=job_name)
    job.put()
    worker = get_worker(job_name)
    if worker['pre_request']:
        early_response = worker['pre_request'](request)
        if early_response is not None:
            return early_response
    @as_json
    def data(request):
        return {
            'job_key': str(job.key()),
            'success': True
        }
    return data(request)
开发者ID:BubbleTouchSoftware,项目名称:chirpradio,代码行数:21,代码来源:views.py

示例6: test_product

# 需要导入模块: from jobs.models import Job [as 别名]
# 或者: from jobs.models.Job import put [as 别名]
 def test_product(self):
     job = Job(job_name='some-job')
     job.put()
     response = self.client.get(reverse('jobs.product',
                                args=[str(job.key())]))
     self.assertEqual(response.status_code, 403)
开发者ID:BubbleTouchSoftware,项目名称:chirpradio,代码行数:8,代码来源:tests.py


注:本文中的jobs.models.Job.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。