Ejemplo n.º 1
0
    def addDL(private_key: str, experience: int, number: int, validity: str,
              catA: bool, catB: bool, catC: bool) -> None:
        """Добавить вод.удост  формат даты - (ДД.ММ.ГГГГ)"""
        validity = dt.strptime(validity, "%d.%m.%Y")
        validity = int(validity.timestamp())
        response: dict = User.addDL(functional.wallet, private_key, experience,
                                    number, validity, catA, catB, catC)

        if response['status']:
            cli.Logger.info(response['msg'])
        else:
            cli.Logger.warn(response['msg'])
Ejemplo n.º 2
0
def addRiderLicence() -> render_template:
    """Добавить вод.удовст"""
    lastPage: str = session.get('lastPage') if session.get('lastPage') else '/'

    if request.method == 'POST':
        wallet: str = session.get('wallet')
        number: int = int(request.form['number'])
        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

        experience: int = int(request.form['experience'])
        date_: str = request.form['date']
        private_key: str = request.form['private_key']

        date = dt.strptime(date_, '%Y-%d-%m')
        date = int(date.timestamp())
        response = User.addDL(wallet, private_key, experience, number, date,
                              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,
                                   addRiderLicence=True)