本文整理汇总了Python中models.Corporation.Corporation.by_id方法的典型用法代码示例。如果您正苦于以下问题:Python Corporation.by_id方法的具体用法?Python Corporation.by_id怎么用?Python Corporation.by_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Corporation.Corporation
的用法示例。
在下文中一共展示了Corporation.by_id方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: to_dict
# 需要导入模块: from models.Corporation import Corporation [as 别名]
# 或者: from models.Corporation.Corporation import by_id [as 别名]
def to_dict(self):
''' Returns editable data as a dictionary '''
corp = Corporation.by_id(self.corporation_id)
game_level = GameLevel.by_id(self.game_level_id)
return {
'name': self.name,
'uuid': self.uuid,
'corporation': corp.uuid,
'description': self._description,
'difficulty': self.difficulty,
'game_level': game_level.uuid,
}
示例2: has_box_materials
# 需要导入模块: from models.Corporation import Corporation [as 别名]
# 或者: from models.Corporation.Corporation import by_id [as 别名]
def has_box_materials(box):
if not options.use_box_materials_dir:
return False
d=options.game_materials_dir
path = os.path.join(d, box.name)
if os.path.isdir(path):
return box.name
else:
corp = Corporation.by_id(box.corporation_id)
path = os.path.join(d, corp.name, box.name)
if os.path.isdir(path):
return os.path.join(corp.name, box.name)
return False
示例3: to_dict
# 需要导入模块: from models.Corporation import Corporation [as 别名]
# 或者: from models.Corporation.Corporation import by_id [as 别名]
def to_dict(self):
''' Returns editable data as a dictionary '''
corp = Corporation.by_id(self.corporation_id)
game_level = GameLevel.by_id(self.game_level_id)
cat = Category.by_id(self.category_id)
if cat:
category = cat.uuid
else:
category = ""
return {
'name': self.name,
'uuid': self.uuid,
'corporation': corp.uuid,
'category': category,
'operating_system': self.operating_system,
'description': self._description,
'difficulty': self.difficulty,
'game_level': game_level.uuid,
'flag_submission_type': self.flag_submission_type,
'flaglist': self.flaglist(self.id)
}
示例4: corporation
# 需要导入模块: from models.Corporation import Corporation [as 别名]
# 或者: from models.Corporation.Corporation import by_id [as 别名]
def corporation(self):
return Corporation.by_id(self.corporation_id)