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


Python Task.put方法代码示例

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


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

示例1: toggleComplete

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import put [as 别名]
  def toggleComplete(self, *args):
    user = users.get_current_user()
    task = db.GqlQuery('SELECT * FROM Task WHERE ANCESTOR IS :1',db.Key(args[0])).get()
    if task and task.who == user:
        if task.complete:
            task.complete = False
        else:
            task.complete = True
            task.complete_date = datetime.datetime.today()
        task.put()
        if task.complete == True and task.repeat == True:
            # verify that we haven't repeated this already
            repeatTask = db.GqlQuery('SELECT * FROM Task WHERE who = :1 AND name = :2 AND complete = False', task.who, task.name)
            if hasattr(repeatTask, "name") == False:
                repeatTask = Task(name=task.name,
                            who=task.who,
                            tags=task.tags,
                            nudge=task.nudge,
                            nudge_value=task.nudge_value,
                            repeat=task.repeat,
                            last_nudge=task.last_nudge,
			    last_complete=datetime.datetime.today())
                repeatTask.put()
        return True
    else:
        return False
开发者ID:xeb,项目名称:flowdle,代码行数:28,代码来源:rpc.py

示例2: post

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import put [as 别名]
    def post(self):
        try:
            naloga = self.request.get('naloga')
            prioriteta = self.request.get('prioriteta')
            opis = self.request.get('opis')
            datum = self.request.get('termin')
            izvajalec = self.request.get('izvajalec')
# preveri obliko zapisa datuma ce je prazen doda trenutni datum in cas
            if datum == "":
                danes = datetime.datetime.now()
                termin_d = datetime.datetime.strftime(danes,'%d.%m.%Y %H:%M:%S')
                termin = datetime.datetime.strptime(termin_d, '%d.%m.%Y %H:%M:%S')
            else:
                termin = datetime.datetime.strptime(datum,'%d.%m.%Y %H:%M:%S')

            # kreiranje objekta opravilo in shranjevanje v bazo
            opravilo = Task(naloga=naloga, prioriteta=prioriteta, opis=opis, termin=termin, izvajalec=izvajalec)
            opravilo.put()
            # VSE OK vrne na seznam opravil
            return self.redirect_to('osnovna-stran')

        # V primerru napake javi opozoirilo in uporabnik mora napako odpraviti
        except ValueError:
            err = "Datum in ura obezno v formatu d.m.YYYY H:M:S Lahko pa je prazno"
            params = {'err': err}
            return self.render_template('vnos_opravila.html', params=params)
开发者ID:uroscokl,项目名称:PythonGAE,代码行数:28,代码来源:handlers.py

示例3: post

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import put [as 别名]
    def post(self):
        naslov = self.request.get("input-naslov")
        besedilo = self.request.get("input-besedilo")
        pomembnost = int(self.request.get("input-pomembnost"))

        task = Task(naslov=naslov, besedilo=besedilo, pomembnost=pomembnost)

        task.put()
        return self.redirect_to("index")
开发者ID:jO-Osko,项目名称:taskManager,代码行数:11,代码来源:main.py

示例4: post

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import put [as 别名]
 def post(self):
     temp = Task(title=self.request.get("Title"),
             desc=self.request.get("Description"),
             start=self.request.get("Start"),
             due=self.request.get("Due"),
             assigner=self.request.get("Assigner"),
             assignee=self.request.get("Assignee"),
             queue=int(self.request.get("Queue")))
     temp.put()
     self.redirect('/#gantt')
开发者ID:bfeng,项目名称:save-tasks,代码行数:12,代码来源:addtask.py

示例5: new

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import put [as 别名]
def new():
    msg = "Capture una tarea: "
    if request.method == 'POST':
        tsk = Task(description = request.form['description'])
##        tsk = Task(author = 'norbux')
        tsk.put()
##        flash('Tarea registrada')
        return redirect(url_for('test'))
##        return request.form['description']
    return render_template('new.html', msg=msg)
开发者ID:norbux,项目名称:norbux,代码行数:12,代码来源:app.py

示例6: post

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import put [as 别名]
    def post(self):
        name = self.request.get("task_name")
        message = self.request.get("task_message")
        message2 = self.request.get("task_message2")
        checked = bool(self.request.get("task_check"))

        task = Task(name=name, message=message, message2=message2, checked=checked)
        task.put()

        return self.write("You have written: " + "\n" + " name: " + name + " message: " + message + " message2: " +
                          message2 + " check: " + str(checked))
开发者ID:KleEnder,项目名称:test_app_todo,代码行数:13,代码来源:main.py

示例7: task_create

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import put [as 别名]
def task_create(action, action_id, args=None, kw=None, expire=None):
    if args is None:
        args = []
    if kw is None:
        kw = {}

    key_name = Task.key_from(action=action, action_id=action_id)
    task_ref = Task(
        key_name="task/%s/%s" % (action, action_id), action=action, action_id=action_id, expire=expire, args=args, kw=kw
    )
    task_ref.put()
    return task_ref
开发者ID:garethr,项目名称:appengine-queue,代码行数:14,代码来源:__init__.py

示例8: receive

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import put [as 别名]
 def receive(self, mail_message):
   # logging.info("Message sender: " + mail_message.sender)
   # logging.info("Message to: " + mail_message.to)
   # logging.info("Message date: " + mail_message.date)
   # logging.info("Message subject: " + mail_message.subject)
   description = ''
   for content_type, body in mail_message.bodies('text/plain'):
     description = body.decode()
     logging.info("Message body:\n" + description)
   
   now = int(time.mktime(datetime.datetime.utcnow().timetuple())*1000)
   task = Task(name=mail_message.subject, description=description, createdAt=now, updatedAt=now)
   task.put()
开发者ID:joshholt,项目名称:SproutCoreTasks-AppEngineBackend,代码行数:15,代码来源:main.py

示例9: testInsertEntity

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import put [as 别名]
    def testInsertEntity(self):

        # Save Entity
        t = Task()
        t.description = "Hello World"
        t.completed = True
        t.put()

        # Retrieve Entity
        database_task = Task.query().fetch(20)

        # Test retrieved entity
        self.assertEqual(1, len(database_task))
        self.assertEqual(True, database_task[0].completed)
        self.assertEqual("Hello World", database_task[0].description)
开发者ID:py-yyc,项目名称:todos_app,代码行数:17,代码来源:tests.py

示例10: post

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import put [as 别名]
 def post(self):
     d = datetime.datetime.strptime(self.request.get('date'), '%d-%m-%Y')
     session = Session(self.request)
     user = User.get_by_id(session.email)
     
     task = Task(name=self.request.get('name'),
                 description=self.request.get('description'),
                 date=d,
                 status='Pendiente',
                 priority = self.request.get('priority'),
                 email = self.request.get('email',False) !=False,
                 author=user.key,
                 )
     task.put()
     self.redirect('/')
开发者ID:sarts3,项目名称:to-do-list,代码行数:17,代码来源:main.py

示例11: upload_task

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import put [as 别名]
 def upload_task(num, result, interpreter, testcommand, log):
     p = PullRequest.all()
     p.filter("num =", int(num))
     p = p.get()
     if p is None:
         # Create the pull request:
         p = PullRequest(num=num)
         p.put()
     t = Task(pullrequest=p)
     t.result = result
     t.interpreter = interpreter
     t.testcommand = testcommand
     t.log = log
     t.put()
     result = {"ok": True, "task_url": "%s/report/%s" % (url_base, t.key())}
     return result
开发者ID:harishma,项目名称:sympy-bot,代码行数:18,代码来源:main.py

示例12: todo

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import put [as 别名]
def todo(command_args, account):
    title = command_args
    
    task = Task(proposer=account.user,
                proposed=datetime.datetime.now(),
                title=title,
                uuid=uuid.uuid1().hex,
                status=db.Category("todo"),
                blocks = account.task)
    task.put()
    
    command = Command(user=account.user,
                      created=datetime.datetime.now(),
                      root="TODO",
                      args=command_args,
                      task=task)
    command.put()
开发者ID:bmander,项目名称:amaurot,代码行数:19,代码来源:views.py

示例13: post

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import put [as 别名]
    def post(self, urlparam):
        cmn = Common()
        user = users.get_current_user()

        taskkey = len(str(self.request.get("taskkey")))
        if taskkey > 0:
            task = db.GqlQuery(
                "SELECT * FROM Task WHERE ANCESTOR IS :1 AND who = :2", db.Key(self.request.get("taskkey")), user
            ).get()
            if task == None:
                self.redirect("/app/all")
            else:
                task.name = cmn.strip_tags(self.request.get("taskname")[:200])
                task.nudge = self.request.get("nudge")
                task.when = datetime.datetime.today()
        else:
            task = Task(
                name=cmn.strip_tags(self.request.get("taskname")[:200]), who=user, nudge=self.request.get("nudge")
            )

        if self.request.get("taglist"):
            task.tags = cmn.setTags(self.request.get("taglist"))

        if task.nudge == "monthly":
            task.nudge_value = self.request.get("nudge_month_value")[:3]
        elif task.nudge == "weekly":
            task.nudge_value = self.request.get("nudge_day")[:3]
        elif task.nudge == "yearly":
            task.nudge_value = self.request.get("nudge_year_value")[:6]

        if self.request.get("repeat") == "True":
            task.repeat = True
        else:
            task.repeat = False

        task.put()

        tagstr = urlparam[8:]
        if tagstr:
            self.redirect("/app/tagged/" + tagstr)
        else:
            self.redirect("/app/all")
开发者ID:xeb,项目名称:flowdle,代码行数:44,代码来源:app.py

示例14: push

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import put [as 别名]
def push(command_args, account):
    title = command_args
    
    task = Task(proposer=account.user,
                proposed=datetime.datetime.now(),
                title=title,
                uuid=uuid.uuid1().hex,
                status=db.Category("underway"),
                blocks = account.task)
    task.put()

    account.task = task
    account.put()
    
    command = Command(user=account.user,
                      created=datetime.datetime.now(),
                      root="PUSH",
                      args=command_args,
                      task=task)
    command.put()
开发者ID:bmander,项目名称:amaurot,代码行数:22,代码来源:views.py

示例15: add

# 需要导入模块: from models import Task [as 别名]
# 或者: from models.Task import put [as 别名]
def add():
    # Create a new chore form
    form = TaskForm()

    # Check for a POST and validate the form data
    if form.validate_on_submit():
        # Create a new chore with the current user as the parent
        newTask = Task(parent=ndb.Key("User", users.get_current_user().email()))

        # Fill in the details and insert it into the database
        newTask.name = form.name.data
        newTask.description = form.description.data
        newTask.points = form.points.data
        newTask.point_type = form.point_type.data
        newTask.put()

        # Automatically redirect the user to the chore list
        return redirect(url_for('.list'))

    # If not POSTing then display the default new chore form
    return render_template('tasks/new_task.html', form=form)
开发者ID:jmgilman,项目名称:Omega-Python,代码行数:23,代码来源:controllers.py


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