本文整理汇总了Python中model.Task.put方法的典型用法代码示例。如果您正苦于以下问题:Python Task.put方法的具体用法?Python Task.put怎么用?Python Task.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.Task
的用法示例。
在下文中一共展示了Task.put方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from model import Task [as 别名]
# 或者: from model.Task import put [as 别名]
def post(self):
task = Task(name=self.request.get('name'),
done=self.request.get('done'),
progress=int(self.request.get('progress')),
questKey=ndb.Key(Quest, int(self.request.get('questId'))))
task.put()
task = task.to_dct()
self.response.write(task['id'])
示例2: addTask
# 需要导入模块: from model import Task [as 别名]
# 或者: from model.Task import put [as 别名]
def addTask(phone, url, periods, sendDateTimeList, smsType, smsSender):
task = Task(phone=phone,
url=url,
periods=map(
int, periods.split(';')),
sendDateTimeList=[datetime.strptime(dateString.strip(), settings.TIMEFORMAT) for dateString in sendDateTimeList.split(';') if dateString.strip()],
smsType=smsType.strip(),
smsSender=smsSender.strip())
task.put()
示例3: post
# 需要导入模块: from model import Task [as 别名]
# 或者: from model.Task import put [as 别名]
def post(self):
name = self.request.get("name")
url = self.request.get("url")
if (not name or not url):
self.response.out.write("name and url required")
return
# name and url ok
new_task = Task(name = name, url = url.strip())
new_task.put()
#self.response.out.write('<p>Task added OK</p><p><a href="/">back</a></p>')
self.redirect("/list")
示例4: txn
# 需要导入模块: from model import Task [as 别名]
# 或者: from model.Task import put [as 别名]
def txn():
task = Task(parent=Domain.key_from_name(domain_identifier),
description=description,
user=user,
context=user.default_context_key())
# TODO(tijmen): This get is redundant, the key can
# be derived from the identifier and the domain.
parent_task = get_task(domain_identifier, parent_task_identifier)
task.parent_task = parent_task
task.put()
workers.UpdateTaskCompletion.enqueue(domain_identifier,
task.identifier(),
transactional=True)
workers.UpdateTaskHierarchy.enqueue(domain_identifier,
task.identifier(),
transactional=True)
return task
示例5: txn
# 需要导入模块: from model import Task [as 别名]
# 或者: from model.Task import put [as 别名]
def txn():
super_task = None
if parent_task:
super_task = get_task(domain, parent_task)
if not super_task:
raise ValueError("Parent task does not exist")
task = Task(parent=Domain.key_from_name(domain),
description=description,
user=user,
context=user.default_context_key(),
parent_task=super_task,
level=super_task.level + 1 if super_task else 0)
if super_task:
super_task.number_of_subtasks = super_task.number_of_subtasks + 1
super_task.increment_incomplete_subtasks()
super_task.put()
if assignee:
task.baked_assignee_description = assignee.name
task.put()
return task
示例6: get
# 需要导入模块: from model import Task [as 别名]
# 或者: from model.Task import put [as 别名]
def get(self):
ndb.delete_multi(
Project.query().fetch(keys_only=True)
)
ndb.delete_multi(
Quest.query().fetch(keys_only=True)
)
ndb.delete_multi(
Task.query().fetch(keys_only=True)
)
project = Project(name="project 01", progress=0,
description="descricao", xp=100)
project.put()
quest = Quest(name="quest 01", description="description",
xp=30, deadline="2013-11-21",
progress=0, projectKey=project.key)
quest.put()
task = Task(name="task 01", done="false",
xp=15, progress=50,
questKey=quest.key)
task.put()
task = Task(name="task 02", done="false",
xp=15, progress=50,
questKey=quest.key)
task.put()
quest = Quest(name="quest 02", description="description",
xp=30, deadline="2013-12-10",
progress=0, projectKey=project.key)
quest.put()
task = Task(name="task 01", done="false",
xp=15, progress=50,
questKey=quest.key)
task.put()
task = Task(name="task 02", done="false",
xp=15, progress=50,
questKey=quest.key)
task.put()
quest = Quest(name="quest 03", description="description",
xp=30, deadline="2014-01-10",
progress=0, projectKey=project.key)
quest.put()
task = Task(name="task 01", done="false",
xp=15, progress=50,
questKey=quest.key)
task.put()
task = Task(name="task 02", done="false",
xp=15, progress=50,
questKey=quest.key)
task.put()
self.response.write("ok")
示例7: get
# 需要导入模块: from model import Task [as 别名]
# 或者: from model.Task import put [as 别名]
def get(self):
photo = None
# if IDENTIFIER_TASK_PHOTO in req_json:
# photo = req_json[IDENTIFIER_TASK_PHOTO]
task_id = uuid.uuid4()
# req_json = json.loads(self.request.body)
# task_name = req_json[IDENTIFIER_TASK_NAME]
task_name = self.request.get(IDENTIFIER_TASK_NAME)
# creater_email = req_json[IDENTIFIER_USER_EMAIL]
creater_email = self.request.get(IDENTIFIER_USER_EMAIL)
#create a new expense
expense_id = uuid.uuid4()
# req_json = json.loads(self.request.body)
expense_name = "Task_"+task_name
# candidate_lst= req_json[IDENTIFIER_USER_EMAIL_LIST]
candidates = self.request.get(IDENTIFIER_USER_EMAIL_LIST)
candidate_lst = candidates.split(",")
# description = req_json[IDENTIFIER_DESCRIPTION_NAME]
description = self.request.get(IDENTIFIER_DESCRIPTION_NAME)
apt_id = self.request.get(IDENTIFIER_APT_ID)
target_apt_lst = Apartment.query(Apartment.apt_id == apt_id).fetch()
if len(target_apt_lst)!=0:
target_apt = target_apt_lst[0]
print "Found the target_apt " + target_apt.apt_name
new_expense = Expense(apt_id = target_apt.apt_id,
creater_email = creater_email,
user_email_lst = candidate_lst,
cover_url = None,
expense_name = expense_name,
total_cost = 0,
is_paid = False,
expense_id = str(expense_id ))
target_apt.expense_id_lst.insert(0, str(expense_id))
new_expense.put()
target_apt.put()
task_id_lst = new_expense.task_id_lst
if not task_id_lst:
task_id_lst = []
task_id_lst.append(str(task_id))
new_expense.task_id_lst = task_id_lst
new_expense.put()
# # expenses = Expense.query(Expense.expense_id == expense_id).fetch()
# # expense = expenses[0]
# expense.task_id_lst.append(str(task_id))
# expense.put()
new_task = Task(task_name = task_name, expense_id = str(expense_id), creater_email = creater_email,
candidate_lst = candidate_lst, description = description, photo_blobkey = photo, task_id = str(task_id),
finished = False, assigned = False)
new_task.put()
self.respond(task_id = str(task_id), status="Success")