def reg(self, bot, update): text = 'Что-то пошло не так...' try: mestext = update.message.text args = mestext.split(' ')[1:] user = User.getName(args) print(user) try: p = Person() #usertable.create(chat_id=update.message.chat_id, name=user['name'], surname=user['surname'], patronymic=user['patronymic']) text = p.create(chat_id=update.message.chat_id, name=user['name'], surname=user['surname'], patronymic=user['patronymic']) except Exception as e: self.debprint('Error in DB ' + str(e)) text = 'Ошибка в БД' except Exception as e: self.debprint(e, '', True) text = 'Ошибка при обработке данных' finally: bot.sendMessage(chat_id=update.message.chat_id, text=text)
from flask import render_template, request, redirect, url_for from app import app #imports the user class from the libraries folder to be #able to use the user methods from lib.user import User #Creates a new user and checks if the user exists user = User('*****@*****.**', 'awesomesauce') user.exist() #gets username username = user.getName() #The following code uses flask methods to communicate between #the database via the user class and the html pages using Jinja2 #variables @app.route('/', methods=['GET', 'POST']) @app.route('/index.html', methods=['GET', 'POST']) def index(): #gets the grocery lists associated #with the user glists = user.getGListsItemList() #gets a lists of names for all the user's grocery lists gListNames = user.getGListsNames() #Post requests in flask mean that the user has clicked on a button or link
from flask import render_template, request, redirect, url_for from app import app #imports the user class from the libraries folder to be #able to use the user methods from lib.user import User #Creates a new user and checks if the user exists user = User('*****@*****.**', 'awesomesauce') user.exist() #gets username username = user.getName() #The following code uses flask methods to communicate between #the database via the user class and the html pages using Jinja2 #variables @app.route('/', methods=['GET', 'POST']) @app.route('/index.html', methods=['GET', 'POST']) def index(): #gets the grocery lists associated #with the user glists = user.getGListsItemList() #gets a lists of names for all the user's grocery lists gListNames = user.getGListsNames() #Post requests in flask mean that the user has clicked on a button or link