本文整理汇总了Python中models.robot.Robot.get_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python Robot.get_by_id方法的具体用法?Python Robot.get_by_id怎么用?Python Robot.get_by_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.robot.Robot
的用法示例。
在下文中一共展示了Robot.get_by_id方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_form
# 需要导入模块: from models.robot import Robot [as 别名]
# 或者: from models.robot.Robot import get_by_id [as 别名]
def show_form(self, mid=None):
if mid:
robot = Robot.get_by_id(int(mid), parent=self.current_user.key)
else:
robot = Robot()
form = forms.RobotForm(data=robot.to_dict())
self.render_response('robot/form.html', form=form, mid=mid, robot=robot)
示例2: test_set_robot_name
# 需要导入模块: from models.robot import Robot [as 别名]
# 或者: from models.robot.Robot import get_by_id [as 别名]
def test_set_robot_name(self):
self.loginUser()
self.giveTeamAdminAccess()
# There is no Robot models that exists yet for this team
form = self.getTeamInfoForm(1124)
form['robot_name'] = 'Test Robot Name'
response = form.submit().follow()
self.assertEqual(response.status_int, 301)
robot = Robot.get_by_id(Robot.renderKeyName('frc1124', self.now.year))
self.assertIsNotNone(robot)
self.assertEqual(robot.robot_name, 'Test Robot Name')
示例3: process_form
# 需要导入模块: from models.robot import Robot [as 别名]
# 或者: from models.robot.Robot import get_by_id [as 别名]
def process_form(self, mid, dsid):
robot = Robot.get_by_id(int(mid), parent=self.current_user.key)
if dsid:
dataset = DataSet.get_by_id(int(dsid), parent=robot.key)
else:
dataset = DataSet(parent=robot.key)
form = forms.DataSetForm(self.request.POST)
if form.validate():
dataset.populate(**form.data)
key = dataset.put()
return self.redirect_to('dataset-edit', mid=mid, dsid=key.id())
self.render_response('robot/datasetform.html', form=form, mid=mid, dsid=dsid,
dataset=dataset)
示例4: test_delete_robot_name
# 需要导入模块: from models.robot import Robot [as 别名]
# 或者: from models.robot.Robot import get_by_id [as 别名]
def test_delete_robot_name(self):
self.loginUser()
self.giveTeamAdminAccess()
Robot(
id=Robot.renderKeyName(self.team.key_name, self.now.year),
team=self.team.key,
year=self.now.year,
robot_name='First Robot Name',
).put()
form = self.getTeamInfoForm(1124)
self.assertEqual(form['robot_name'].value, 'First Robot Name')
form['robot_name'] = ''
response = form.submit().follow()
self.assertEqual(response.status_int, 301)
robot = Robot.get_by_id(Robot.renderKeyName('frc1124', self.now.year))
self.assertIsNone(robot)
示例5: run
# 需要导入模块: from models.robot import Robot [as 别名]
# 或者: from models.robot.Robot import get_by_id [as 别名]
def run(self, mid):
robot = Robot.get_by_id(int(mid), parent=self.current_user.key)
taskmanager.enqueue_robot('/task/runrobot', robot)
self.response.write(json.encode({'status': 'ok'}))
示例6: view_crawl
# 需要导入模块: from models.robot import Robot [as 别名]
# 或者: from models.robot.Robot import get_by_id [as 别名]
def view_crawl(self, mid, cid):
robot = Robot.get_by_id(int(mid), parent=self.current_user.key)
crawl = Crawl.get_by_id(int(cid), parent=robot.key)
jobs = crawl.jobs
self.render_response('robot/crawl.html', robot=robot, crawl=crawl, jobs=jobs)
示例7: delete
# 需要导入模块: from models.robot import Robot [as 别名]
# 或者: from models.robot.Robot import get_by_id [as 别名]
def delete(self, mid):
robot = Robot.get_by_id(int(mid), parent=self.current_user.key)
robot.key.delete()
return self.redirect_to('robot-index')
示例8: view
# 需要导入模块: from models.robot import Robot [as 别名]
# 或者: from models.robot.Robot import get_by_id [as 别名]
def view(self, mid):
robot = Robot.get_by_id(int(mid), parent=self.current_user.key)
crawls = Crawl.query(ancestor=robot.key).order(-Crawl.started_at).fetch()
datasets = DataSet.query(ancestor=robot.key).fetch()
self.render_response('robot/view.html', robot=robot, mid=mid, crawls=crawls,
datasets=datasets, schedules=SCHEDULES)