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


Python Job.all方法代码示例

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


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

示例1: get

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import all [as 别名]
    def get(self, job_id):
        job = Job.get_by_key_name(job_id)

        if job and job.state != DONE and job.active == True:
            job.updated_at = datetime.now()
            job.state = DONE
            job.put()
            # update the email
            email = job.email
            email.updated_at = datetime.now()
            email.put()
            # count the number of jobs attached to this flyer
            job_query = Job.all()
            job_query.filter("flyer =", job.flyer)
            job_query.filter("active =", True)
            total_jobs = job_query.count()
            # count the number of jobs done so far
            job_query = Job.all()
            job_query.filter("flyer =", job.flyer)
            job_query.filter("active =", True)
            job_query.filter("state =", DONE)
            done_jobs = job_query.count()
            # write out
            self.response.out.write(template.render("templates/finish.html",
                                                    {"total": total_jobs,
                                                     "done": done_jobs}))
        else:
            self.error(404)
开发者ID:thenoviceoof,项目名称:flyer-poke,代码行数:30,代码来源:flyer.py

示例2: get

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import all [as 别名]
 def get(self, email):
     q = Job.all()
     q.filter("email =", urllib.unquote(email))
     jobs = q.fetch(BOUND)
     for job in jobs:
         job.delete()
     self.response.out.write(template.render("templates/sorry.html", {}))
开发者ID:adi-archive,项目名称:flyer-poke,代码行数:9,代码来源:flyer.py

示例3: post

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import all [as 别名]
 def post(self, job_id):
     job = Job.get_by_key_name(job_id)
     # make sure the job is recent
     if not(job.active):
         self.error(404)
     email = job.email
     email.enable = False
     email.updated_at = datetime.datetime.now()
     email.put()
     # find the email-club join
     join_query = EmailToClub.all()
     join_query.filter("email =", email)
     joins = join_query.fetch(20)
     # do the delete
     for join in joins:
         join.enable = False
         join.updated_at = datetime.now()
         join.put()
     # mark all the jobs inactive
     job_query = Job.all()
     job_query.filter("email =", email)
     job_query.filter("active =", True)
     jobs = job_query.fetch(20)
     for job in jobs:
         job.active = False
         job.put()
     self.response.out.write(template.render("templates/sorry.html", {}))
开发者ID:thenoviceoof,项目名称:flyer-poke,代码行数:29,代码来源:flyer.py

示例4: get

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import all [as 别名]
    def get(self):
        t = list(time.localtime())
        t[2] -= 31
        dt = datetime.fromtimestamp(time.mktime(t))

        jobs = Job.all()
        jobs.filter("date <", dt)
        jobs = jobs.fetch()
        for job in jobs:
            job.delete()
        self.response.out.write(template.render("templates/task.html",
                                                {"msg": "Removed old ones"}))
开发者ID:thenoviceoof,项目名称:flyer-poke,代码行数:14,代码来源:admin.py

示例5: get

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import all [as 别名]
 def get(self):
     jobs = Job.all().order("title").fetch(MAX_FETCH_LIMIT)
     job_list = []
     for item in jobs:
         job_list.append(item.to_json_dict("title", "is_starred", "is_active", "is_deleted", "when_created"))
     self.response.out.write(json.dumps(job_list))
开发者ID:aswadrangnekar,项目名称:tiss-secure,代码行数:8,代码来源:api.py


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