Exemplo n.º 1
0
def addNewCategory() -> render_template:
    """Добавить новую категорию ТС"""

    lastPage: str = session.get('lastPage') if session.get('lastPage') else '/'

    if request.method == 'POST':
        wallet: str = session.get('wallet')
        if 'catA' in request.form:
            catA: bool = True
        else:
            catA: bool = False

        if 'catB' in request.form:
            catB: bool = True
        else:
            catB: bool = False

        if 'catC' in request.form:
            catC: bool = True
        else:
            catC: bool = False
        private_key: str = request.form['private_key']

        response = User.addNewCategory(wallet, private_key, catA, catB, catC)
        if response['status']:
            flash(response['msg'])
            return render_template('html/main.html',
                                   lastPage=lastPage,
                                   info=True)
        else:
            flash(response['msg'])
            return render_template('html/main.html',
                                   lastPage=lastPage,
                                   addCategoryRiderLicence=True)
Exemplo n.º 2
0
    def addNewCategory(private_key: str, catA: bool, catB: bool,
                       catC: bool) -> None:
        """Добавить новую категорию ТС в права"""

        response: dict = User.addNewCategory(functional.wallet, private_key,
                                             catA, catB, catC)

        if response['status']:
            cli.Logger.info(response['msg'])
        else:
            cli.Logger.warn(response['msg'])