本文整理汇总了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)
示例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,
}
示例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,
}
示例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()
}
示例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), ])
示例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)
示例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)