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


Python Box.by_id方法代码示例

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


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

示例1: render_page

# 需要导入模块: from models.Box import Box [as 别名]
# 或者: from models.Box.Box import by_id [as 别名]
 def render_page(self, flag, errors=[]):
     ''' Wrapper to .render() to avoid duplicate code '''
     user = self.get_current_user()
     box = Box.by_id(flag.box_id)
     self.render('missions/box.html',
                 box=box,
                 team=user.team,
                 errors=errors)
开发者ID:AnarKyx01,项目名称:RootTheBox,代码行数:10,代码来源:MissionsHandler.py

示例2: to_dict

# 需要导入模块: from models.Box import Box [as 别名]
# 或者: from models.Box.Box import by_id [as 别名]
 def to_dict(self):
     ''' Returns public data as a dict '''
     box = Box.by_id(self.box_id)
     return {
         'name': self.name,
         'uuid': self.uuid,
         'description': self.description,
         'capture_message': self.capture_message,
         'value': self.value,
         'box': box.uuid,
         'token': self.token,
     }
开发者ID:bincker,项目名称:RootTheBox,代码行数:14,代码来源:Flag.py

示例3: to_dict

# 需要导入模块: from models.Box import Box [as 别名]
# 或者: from models.Box.Box import by_id [as 别名]
 def to_dict(self):
     """ Returns public data as a dict """
     box = Box.by_id(self.box_id)
     return {
         "name": self.name,
         "uuid": self.uuid,
         "description": self.description,
         "capture_message": self.capture_message,
         "value": self.value,
         "box": box.uuid,
         "token": self.token,
     }
开发者ID:liorvh,项目名称:RootTheBox,代码行数:14,代码来源:Flag.py

示例4: to_dict

# 需要导入模块: from models.Box import Box [as 别名]
# 或者: from models.Box.Box import by_id [as 别名]
 def to_dict(self):
     ''' Returns public data as a dict '''
     box = Box.by_id(self.box_id)
     if self.lock_id:
         lock_uuid = Flag.by_id(self.lock_id).uuid
     else:
         lock_uuid = ''
     case_sensitive = self.case_sensitive
     if case_sensitive != 0:
         case_sensitive = 1
     return {
         'name': self.name,
         'uuid': self.uuid,
         'description': self.description,
         'capture_message': self.capture_message,
         'value': self.value,
         'original_value': self.original_value,
         'box': box.uuid,
         'token': self.token,
         'lock_uuid': lock_uuid,
         'case-sensitive': case_sensitive,
         'flagtype': self.type,
         'choices': self.choices()
     }
开发者ID:moloch--,项目名称:RootTheBox,代码行数:26,代码来源:Flag.py

示例5: edit_hint

# 需要导入模块: from models.Box import Box [as 别名]
# 或者: from models.Box.Box import by_id [as 别名]
 def edit_hint(self):
     ''' Edit a hint object '''
     try:
         hint = Hint.by_uuid(self.get_argument('uuid', ''))
         if hint is None:
             raise ValidationError("Hint does not exist")
         logging.debug("Edit hint object with uuid of %s" % hint.uuid)
         price = self.get_argument('price', '')
         if hint.price != price:
             hint.price = price
         description = self.get_argument('description', '')
         hint.description = description
         flag = Flag.by_uuid(self.get_argument('hint-flag_uuid', ''))
         if flag:
             flag_id = flag.id
         else:
             flag_id = None
         hint.flag_id = flag_id
         box = Box.by_id(flag.box_id)
         self.dbsession.add(hint)
         self.dbsession.commit()
         self.redirect("/admin/view/game_objects#%s" % box.uuid)
     except ValidationError as error:
         self.render("admin/view/game_objects.html", errors=[str(error), ])
开发者ID:moloch--,项目名称:RootTheBox,代码行数:26,代码来源:AdminGameObjectHandlers.py

示例6: render_page_by_box_id

# 需要导入模块: from models.Box import Box [as 别名]
# 或者: from models.Box.Box import by_id [as 别名]
 def render_page_by_box_id(self, box_id, errors=[], success=[], info=[]):
     box = Box.by_id(box_id)
     self.render_page_by_box(box, errors, success, info)
开发者ID:moloch--,项目名称:RootTheBox,代码行数:5,代码来源:MissionsHandler.py

示例7: box

# 需要导入模块: from models.Box import Box [as 别名]
# 或者: from models.Box.Box import by_id [as 别名]
 def box(self):
     return Box.by_id(self.box_id)
开发者ID:moloch--,项目名称:RootTheBox,代码行数:4,代码来源:Flag.py


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