def __push_group_conf(self, group, force=False):
for section in [sg.CONF_GROUP_BATTLE_FORMAT, sg.CONF_GROUP_TROLL_FORMAT, sg.CONF_GROUP_MOB_FORMAT, sg.CONF_GROUP_CDM_FORMAT, sg.CONF_GROUP_PIEGE_FORMAT, sg.CONF_GROUP_PORTAL_FORMAT]:
if sg.config.has_section(section):
for (each_key, each_value) in sg.config.items(section):
conf = CONF()
to_add = False
if not force:
try:
conf = sg.db.session.query(CONF).filter(CONF.group_id == group.id, CONF.section == section, CONF.key == each_key).one()
except NoResultFound as e:
to_add = True
if to_add or force:
conf.section = section
conf.key = each_key
conf.value = each_value
conf.group_id = group.id
conf.touch()
sg.db.add(conf)
# Create or update users from JSON file, then if a group is set also do the binding and create the troll
评论列表
文章目录