Exemplo n.º 1
0
def create_new_character(eve_id: int, char_name: str) -> Character:
    char = Character()
    char.id = eve_id
    char.eve_name = char_name
    char.is_new = True
    db.session.add(char)
    db.session.commit()
    return char
Exemplo n.º 2
0
def make_json_character(dbcharacter: Character,
                        scramble_names: bool = False,
                        include_names_from: Optionalcharids = None):
    return {
        'id':
        dbcharacter.get_eve_id() if not scramble_names or
        (include_names_from is not None
         and dbcharacter.get_eve_id() in include_names_from) else None,
        'name':
        dbcharacter.get_eve_name() if not scramble_names or
        (include_names_from is not None
         and dbcharacter.get_eve_id() in include_names_from) else
        'Name Hidden',
        'newbro':
        dbcharacter.is_new()
    }