當前位置: 首頁>>代碼示例>>Python>>正文


Python Robot.get_by_id方法代碼示例

本文整理匯總了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)
開發者ID:notapresent,項目名稱:yukata,代碼行數:10,代碼來源:handlers.py

示例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')
開發者ID:ZachOrr,項目名稱:the-blue-alliance,代碼行數:15,代碼來源:test_suggest_team_admin_review.py

示例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)
開發者ID:notapresent,項目名稱:yukata,代碼行數:18,代碼來源:handlers.py

示例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)
開發者ID:ZachOrr,項目名稱:the-blue-alliance,代碼行數:21,代碼來源:test_suggest_team_admin_review.py

示例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'}))
開發者ID:notapresent,項目名稱:yukata,代碼行數:6,代碼來源:handlers.py

示例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)
開發者ID:notapresent,項目名稱:yukata,代碼行數:7,代碼來源:handlers.py

示例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')
開發者ID:notapresent,項目名稱:yukata,代碼行數:6,代碼來源:handlers.py

示例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)
開發者ID:notapresent,項目名稱:yukata,代碼行數:8,代碼來源:handlers.py


注:本文中的models.robot.Robot.get_by_id方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。