def EliminarServicio(id): urlrev = URLBASE delete_ofservicio = dict() delete_ofservicio = {'TABLE':'servicio', 'Whe1':'id=' + id } Del_TOServicioPtdo= Model(delete_ofservicio) sql = Del_TOServicioPtdo.DELWT_TABLE() cursor = db1.cursor() cursor.execute(sql) cursor.close() db1.commit() TSSOfServicio = dict() TSSOfServicio = {'TABLE':'servicio', 'Col1':'id', 'Col2':'tipo', 'Col3':'costo', 'Col4':'detalles' } TSOfSevicio = Model(TSSOfServicio) sql = TSOfSevicio.SSP_TABLE() cursor = db1.cursor() cursor.execute(sql) DatosOfServicio = cursor.fetchall() return render_template("/lavasplash/ListaOfServicios.html", url = urlrev, Oferta_Servicio = DatosOfServicio)
def NewWord(): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect=Model(username) Tabla_All_Grupos = dict() Tabla_All_Grupos = {'TABLE':'grupo', 'Col1':'id', 'Col2':'topico' } result = {} result["message"] = "Registro exitoso" DatosAllGrupos = connect.SSP_TABLE(username, Tabla_All_Grupos) Tabla_All_Words = dict() Tabla_All_Words = {'TABLE':'vocabulary', 'Col1':'id', 'Col2':'english', 'Col3':'spanish', 'Col4':'pronunc' } DatosAllWords = connect.SSP_TABLE(username, Tabla_All_Words) return render_template("/admin/addNewWord.html", url = urlrev, grupos = DatosAllGrupos, words = DatosAllWords, result = result)
def ActualizarServicio(): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect=Model(username) if request.method == "POST": id = request.form['id'] tipo = request.form['tipo'] costo = request.form['costo'] obs = request.form['obs'] Update_ofservicio = dict() Update_ofservicio = {'TABLE':'servicio', 'Val1':'tipo=%s', 'Val2':'costo=%s', 'Val3':'detalles=%s', 'Whe4':'id='+ id } Data = [tipo, costo, obs] '''Update_TOServicio= Model(Update_ofservicio) sql = Update_TOServicio.UPT_TABLE() cursor = db1.cursor() cursor.execute(sql, (tipo, costo, obs)) cursor.close() db1.commit()''' res_update = connect.UPWT_TABLE(username, Update_ofservicio, Data) TSSOfServicio = dict() TSSOfServicio = {'TABLE':'servicio', 'Col1':'id', 'Col2':'tipo', 'Col3':'costo', 'Col4':'detalles' } DatosOfServicio = connect.SSP_TABLE(username,TSSOfServicio) return render_template("/lavasplash/ListaOfServicios.html", url = urlrev, Oferta_Servicio = DatosOfServicio)
def blog(): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect=Model(username) Tabla_All_Post = dict() Tabla_All_Post = {'TABLE':'post', 'Col1':'post.id', 'Col2':'post.title', 'Col3':'post.image', 'Col4':'post.created_at', 'Col5':'blg_category.name', 'Col6':'post.summary', 'Col7':'post.category_id' } tables = dict() tables = { 'table1':'post', 'id_t1':'category_id', 'table2':'blg_category', 'id_t2':'id' } #DatosAllProveedores = connect.SSP_TABLE(username, Tabla_All_Proveedores) list_post = connect.SINJ_TABLE(username, Tabla_All_Post, tables) #print(list_post) return render_template("/blog/blog.html", url = urlrev, all_post = list_post)
def index(): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect = Model(username) wid = "1" TablaServicioAutomotor = dict() TablaServicioAutomotor = { 'TABLE': 'products', 'Col1': 'id_product', 'Col2': 'id_proveedor', 'Col3': 'id_categoria', 'Col4': 'name', 'Col5': 'precio', 'Col6': 'descripcion', 'Whe7': 'id_product=%s' } Data = (wid, ) url_product = "/home/product" + "_" + wid + ".html" DatosServicioV = connect.SW_TABLE(username, TablaServicioAutomotor, Data) print(DatosServicioV) id_pdt = "/static/imgs/img_product_" + wid + ".jpeg" return render_template("/home/index.html", url=urlrev, Oferta_Servicio=DatosServicioV, id_pdt=id_pdt)
def AddCategoryBlg(): Urlbase = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect = Model(username) req = request.get_json() result = {} name_category = req["name_category"] #id = None Insert_ofCategory = dict() Insert_ofCategory = { 'TABLE': 'blg_category', 'Col1': 'id', 'Col2': 'name', 'Val3': '%s', 'Val4': '%s' } nombre_id = "id" nombre_tabla = "blg_category" id_max = connect.MAX_ID_TABLE(username, nombre_tabla, nombre_id) print(id_max[0]["max_id"]) if id_max[0]["max_id"] == None: id_sig = "1" else: proximo_id = id_max[0]["max_id"] + 1 id_sig = str(proximo_id) Data = [id_sig, name_category] ''' result["new_proveedor"] = name ''' res_insert = connect.IT_TABLE(username, Insert_ofCategory, Data) result = {"hola": 2} return result
def Category_id(): Urlbase = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect = Model(username) req = request.get_json() id_categoria = req["id_categoria"] wid = id_categoria TablaServicioAutomotor = dict() TablaServicioAutomotor = { 'TABLE': 'products', 'Col1': 'id_product ', 'Col2': 'id_proveedor', 'Col3': 'id_categoria', 'Col4': 'name', 'Col5': 'precio', 'Col6': 'descripcion', 'Col7': 'media', 'Whe8': 'id_categoria=%s' } Data = (wid, ) DatosServicioV = connect.SW_TABLE(username, TablaServicioAutomotor, Data) print(DatosServicioV) DatosAllMedia = json.dumps(DatosServicioV) return (DatosAllMedia)
def mes(dia_mes): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect=Model(username) lista = dict() lista = {'view':'ListaOfServicios' } detalle = [] servicio_mes = [] gasto_mes = [] #Lista de servicios ofertados. TSSOfServicioOftado = dict() TSSOfServicioOftado = {'TABLE':'servicios order by fecha', 'Col1':'id', 'Col2':'costo_total', 'Col3':'fecha' } DatosOfServicioOftado= connect.SSP_TABLE(username,TSSOfServicioOftado) mis_servicios = {} fecha_recibida = procesar_fechas.proc_fecha() day_init = fecha_recibida.first_day_year(dia_mes) #print(day_init) #listfecha = fecha_recibida.datosdb(dia_mes) cont = 0 #print(listfecha) year_res = fecha_recibida.year_fecha(dia_mes) mes_res = fecha_recibida.month_fecha(dia_mes) dia_res = fecha_recibida.day_fecha(dia_mes) nom_mes = fecha_recibida.nombre_mes(dia_mes) for rows in DatosOfServicioOftado: id = rows["id"] costo_total = rows["costo_total"] fecha = str(rows["fecha"]) year = fecha_recibida.year_fecha(fecha) mes = fecha_recibida.month_fecha(fecha) dia = fecha_recibida.day_fecha(fecha) cont += 1 if mes == mes_res and year == year_res and dia == dia_res: servicio_mes.append(costo_total) mis_servicios[cont]= {"_id":id, "costo_total":costo_total, "fecha": fecha, "dia": dia, "url": urlrev, "mes": nom_mes } return (mis_servicios)
def upload2(): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect = Model(username) result = {} dir_act = os.getcwd() route_file_config = dir_act route_exist = route_file_config.find(ROOT_FILE) print(route_exist) if route_exist > 0: route_dir_files = dir_act + "/app/static/upload/" route_dir_imgs = dir_act + "/app/static/imgs/" print(route_dir_files) else: route_dir_files = dir_act + "/app/static/upload/" #print(route_dir_files) UPLOAD_FOLDER = route_dir_files ALLOWED_EXTENSIONS = {'txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif', 'JPG'} def allowed_file(filename): arg_mtx = filename.split(".") if arg_mtx[1] in ALLOWED_EXTENSIONS: return True else: return False name_file = request.form["name_img"] file = request.files[name_file] print(file.filename) if file.filename == '': result = {"hola": "No has seleccionado ningun archivo"} else: #print(file.content_length) if allowed_file(file.filename) == True: result = {"hola": "Cambio de imagen se realizo con exito"} filename = secure_filename(file.filename) file.save(os.path.join(route_dir_files, filename)) print(os.path.join(route_dir_files, filename)) print(route_dir_imgs) shutil.move(os.path.join(route_dir_files, filename), route_dir_imgs) shutil.move(os.path.join(route_dir_imgs, name_file), route_dir_files) num_files = os.listdir(route_dir_files) name_temp = 'temp' + '-' + str(len(num_files)) os.rename(os.path.join(route_dir_imgs, filename), os.path.join(route_dir_imgs, name_file)) os.rename(os.path.join(route_dir_files, name_file), os.path.join(route_dir_files, name_temp)) else: result = {"hola": "Formato de archivo no valido"} return result
def InsertNewServicioPtdo(): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect=Model(username) if request.method == "POST": id = None id_servicio = request.form['idservicio'] id_cliente = request.form['cliente'] costo = request.form['costo'] fecha = request.form['fecha'] costo_descuento = request.form['costo_descuento'] obs = request.form['obs'] porc_descuento = float(costo_descuento)/float(costo) costo_total = float(costo) * porc_descuento if costo_total == 0: costo_total = float(costo) else: costo_total = costo_total descuento = float(costo) - costo_total Insert_ofservicioPtdo = dict() Insert_ofservicioPtdo = {'TABLE':'servicios', 'Col1':'id', 'Col2':'id_servicio', 'Col3':'id_cliente', 'Col4':'descuento', 'Col5':'costo_total', 'Col6':'costo_desc', 'Col7':'fecha', 'Col8':'observacion', 'Val9':'%s', 'Val10':'%s', 'Val11':'%s', 'Val12':'%s', 'Val13':'%s', 'Val14':'%s', 'Val15':'%s', 'Val16':'%s' } Data = [id, id_servicio, id_cliente, porc_descuento, costo_total, descuento, fecha, obs] res_insert = connect.IT_TABLE(username, Insert_ofservicioPtdo, Data) TSSServicioPtado = dict() TSSServicioPtado = {'TABLE':'servicio', 'Col1':'id', 'Col2':'tipo', 'Col3':'costo', } DatosServicioPtado = connect.SSP_TABLE(username,TSSServicioPtado) return render_template("/lavasplash/home_ls.html", url = urlrev, servicios = DatosServicioPtado)
def tablas(): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect = Model(username) tablas = connect.SHOW_TABLES(username) print(tablas) nom_server = {} nom_server["server"] = server tablas.append(nom_server) result = json.dumps(tablas) return (result)
def NewServicioPtado(): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect=Model(username) TSSServicioPtado = dict() TSSServicioPtado = {'TABLE':'servicio', 'Col1':'id', 'Col2':'tipo', 'Col3':'costo', } DatosServicioPtado = connect.SSP_TABLE(username,TSSServicioPtado) return render_template("/lavasplash/form_new_servicios.html", url = urlrev, servicios = DatosServicioPtado)
def index_ls(): Urlbase = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect=Model(username) #urlrev = URLBASE TSSServicioPtado = {'TABLE':'servicio', 'Col1':'id', 'Col2':'tipo', 'Col3':'costo', } DatosServicioPtado = connect.SSP_TABLE(username,TSSServicioPtado) return render_template("/lavasplash/home_ls.html", url= Urlbase, servicios = DatosServicioPtado)
def AddUserBlg(): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect = Model(username) print(connect) req = request.get_json() #result = {} #wid = req["name_user"] id = None ''' let name_user = evt.target.form[0].value let lastname = evt.target.form[1].value let username = evt.target.form[2].value let email = evt.target.form[3].value let password = evt.target.form[4].value let image = evt.target.form[5].value let created_at = evt.target.form[6].value ''' name_user = req["name_user"] lastname = req["lastname"] user_name = req["username"] email = req["email"] password = req["password"] image = req["image"] created_at = req["created_at"] result = {} Insert_ofblg_user = dict() Insert_ofblg_user = { 'TABLE': 'blg_user', 'Col1': 'id', 'Col2': 'name', 'Col3': 'lastname', 'Col4': 'username', 'Col5': 'email', 'Col6': 'password', 'Col7': 'image', 'Col8': 'created_at', 'Val9': '%s', 'Val10': '%s', 'Val11': '%s', 'Val12': '%s', 'Val13': '%s', 'Val14': '%s', 'Val15': '%s', 'Val16': '%s' } Data = [ id, name_user, lastname, user_name, email, password, image, created_at ] result["new_topico"] = "Registro exitoso" res_insert = connect.IT_TABLE(username, Insert_ofblg_user, Data) return result
def AddPostBlg(): Urlbase = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect = Model(username) req = request.get_json() result = {} id_category = req["id_category"] id_users = req["id_users"] title_post = req["title_post"] date_post = req["date_post"] #id = None Insert_ofPost = dict() Insert_ofPost = { 'TABLE': 'post', 'Col1': 'id', 'Col2': 'title', 'Col3': 'image', 'Col4': 'created_at', 'Col5': 'status', 'Col6': 'user_id', 'Col7': 'category_id', 'Val8': '%s', 'Val9': '%s', 'Val10': '%s', 'Val11': '%s', 'Val12': '%s', 'Val13': '%s', 'Val14': '%s' } nombre_id = "id" nombre_tabla = "post" id_max = connect.MAX_ID_TABLE(username, nombre_tabla, nombre_id) print(id_max[0]["max_id"]) if id_max[0]["max_id"] == None: id_sig = "1" else: proximo_id = id_max[0]["max_id"] + 1 id_sig = str(proximo_id) img_name = "post" + id_sig + "user" + id_users + "catg" + id_category + ".jpg" status = "1" Data = [ id_sig, title_post, img_name, date_post, status, id_users, id_category ] res_insert = connect.IT_TABLE(username, Insert_ofPost, Data) result = {"hola": 2} return result
def NewOfServicio(): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect=Model(username) TSSOfServicio = dict() TSSOfServicio = {'TABLE':'servicio', 'Col1':'id', 'Col2':'tipo', 'Col3':'costo', 'Col4':'detalles' } DatosOfServicio = connect.SSP_TABLE(username,TSSOfServicio) return render_template("/lavasplash/form_new_servicio.html", url = urlrev, Oferta_Servicio = DatosOfServicio)
def Estructura_tabla(): Urlbase = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect = Model(username) req = request.get_json() nombreTabla = req["nombreTabla"] campos_tabla = connect.DESCRIBE_TABLES(username, nombreTabla) print (nombreTabla) estructura = json.dumps(campos_tabla) #print(type(result)) #res = make_response(jsonify({"message": "OK"}), 200) #result1 = "hola" return (estructura)
def singup(): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect = Model(username) if request.method == "POST": id = None nick = request.form['nick'] nombre = request.form['name'] email = request.form['Email'] telefono = request.form['telefono'] direccion = request.form['direccion'] password = request.form['password'] tipo_user = '******' Insert_users = dict() Insert_users = { 'TABLE': 'users', 'Col1': 'id', 'Col2': 'nick', 'Col3': 'nombre', 'Col4': 'email', 'Col5': 'direccion', 'Col6': 'telefono', 'Col7': 'password', 'Col8': 'salt', 'Col9': 'tipo_user', 'Val10': '%s', 'Val11': '%s', 'Val12': '%s', 'Val13': '%s', 'Val14': '%s', 'Val15': '%s', 'Val16': '%s', 'Val17': '%s', 'Val18': '%s' } hash = validaciones.Validar() pass_hash = [] pass_hash = hash.hash_password(password) salt = pass_hash[0] password_hash = pass_hash[1] print(salt) Data = [ id, nick, nombre, email, direccion, telefono, password_hash, salt, tipo_user ] connect.IT_TABLE(username, Insert_users, Data) return render_template("/registro/login.html", url=urlrev)
def single(id): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect = Model(username) wid = id Tabla_All_Post = dict() Tabla_All_Post = {'TABLE':'post', 'Col1':'post.id', 'Col2':'post.title', 'Col3':'post.image', 'Col4':'post.created_at', 'Col5':'blg_category.name', 'Col6':'post.summary', 'Col7':'post.category_id', 'Whe8': 'post.id=%s' } tables = dict() tables = { 'table1':'post', 'id_t1':'category_id', 'table2':'blg_category', 'id_t2':'id' } Data = (wid,) #DatosAllProveedores = connect.SSP_TABLE(username, Tabla_All_Proveedores) list_post_one = connect.SINJ_SW_TABLE(username, Tabla_All_Post, tables, Data) print(list_post_one[0]["id"]) name_post = "post_" + str(list_post_one[0]["id"]) + ".md" dir_md = os.getcwd() route_file_config = dir_md route_exist = route_file_config.find("store") if route_exist > 0: route_file_config = dir_act + "/app/static/md/" + name_post else: route_file_config = dir_act + "/store/app/static/md/" + name_post #readme_file = open(".md", "r") f = open(route_file_config , "r") md_template_string = markdown.markdown( f.read(), extensions=["fenced_code"] ) hola = {"post":1, "content":md_template_string } DatosAllMedia = json.dumps(hola) print(type(md_template_string)) return (DatosAllMedia) #return render_template("/blog/single.html", url = urlrev, datos_post = list_post_one, content_post = html)
def grupos(): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect=Model(username) Tabla_All_Grupos = dict() Tabla_All_Grupos = {'TABLE':'grupo', 'Col1':'id', 'Col2':'topico' } DatosAllGrupos = connect.SSP_TABLE(username, Tabla_All_Grupos) DatosAllGrupos_json = json.dumps(DatosAllGrupos) return (DatosAllGrupos_json)
def NewVerb(): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect=Model(username) Tabla_All_Grupos = dict() Tabla_All_Grupos = {'TABLE':'grupo', 'Col1':'id', 'Col2':'topico' } DatosAllGrupos = connect.SSP_TABLE(username, Tabla_All_Grupos) DatosAllGrupos_json = json.dumps(DatosAllGrupos) return render_template("/admin/addNewVerb.html")
def All_Servicios(): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect=Model(username) Tabla_All_Servicios = dict() Tabla_All_Servicios = {'TABLE':'servicio', 'Col1':'id', 'Col2':'tipo', 'Col3':'costo', 'Col4':'detalles', 'Col5':'automotor', } DatosAllServicios = connect.SSP_TABLE(username, Tabla_All_Servicios) return render_template("/lavasplash/All_Servicios.html", url = urlrev, Oferta_Servicio = DatosAllServicios)
def upload(): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect = Model(username) result = {} result = {"hola": 2} data = request.form print(data) print(type(data)) #file = req["file"] """print(type(id_category))""" dir_act = os.getcwd() route_file_config = dir_act route_exist = route_file_config.find(ROOT_FILE) if route_exist > 0: route_dir_files = dir_act + "/app/static/upload/" print(route_dir_files) else: route_dir_files = dir_act + "/app/static/upload/" print(route_dir_files) UPLOAD_FOLDER = route_dir_files ALLOWED_EXTENSIONS = {'txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif', 'JPG'} def allowed_file(filename): return '.' in filename and \ filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS if request.method == 'POST': file = request.files['file'] # check if the post request has the file part if 'file' not in request.files: return redirect(request.url) # if user does not select file, browser also # submit an empty part without filename if file.filename == '': return redirect(request.url) if file and allowed_file(file.filename): filename = secure_filename(file.filename) file.save(os.path.join(route_dir_files, filename)) print(route_dir_files) return redirect(url_for('admin', filename=filename))
def users_blg(): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect = Model(username) Tabla_All_Categories = dict() Tabla_All_Categories = { 'TABLE': 'blg_user', 'Col1': 'id', 'Col2': 'username' } DatosAllCategories = connect.SSP_TABLE(username, Tabla_All_Categories) DatosAllCategories_json = json.dumps(DatosAllCategories) return (DatosAllCategories_json)
def VerDetallesServicio(id): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect=Model(username) TSSOfServicio = dict() wid = id TSSOfServicio = {'TABLE':'servicio', 'Col1':'id', 'Col2':'tipo', 'Col3':'costo', 'Col4':'detalles', 'Whe5':'id=%s' } Data = (wid,) DatosOfServicio = connect.SW_TABLE(username,TSSOfServicio, Data) return render_template("/lavasplash/ActualizarServicio.html", url = urlrev, Oferta_Servicio = DatosOfServicio)
def all_media_products(): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect = Model(username) Tabla_All_Products = dict() Tabla_All_Products = { 'TABLE': 'products', 'Col1': 'id_product', 'Col2': 'name', 'Col3': 'media' } DatosAllProducts = connect.SSP_TABLE(username, Tabla_All_Products) DatosAllProducts_json = json.dumps(DatosAllProducts) return (DatosAllProducts_json)
def all_media(): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect = Model(username) Tabla_All_Media = dict() Tabla_All_Media = { 'TABLE': 'media', 'Col1': 'id', 'Col2': 'id_product', 'Col3': 'img', 'Col4': 'video', 'Col5': 'tipo' } DatosAllMedia = connect.SSP_TABLE(username, Tabla_All_Media) DatosAllMedia_json = json.dumps(DatosAllMedia) return (DatosAllMedia_json)
def Clientes(): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect=Model(username) TSSOfServicioOftado = dict() TSSOfServicioOftado = {'TABLE':'clientes order by id', 'Col1':'id', 'Col2':'nombre', 'Col3':'direccion', 'Col4':'telefono', 'Col5':'nit', 'Col6':'email', 'Col7':'web', 'Col8':'image', } DatosOfServicioOftado= connect.SSP_TABLE(username,TSSOfServicioOftado) return render_template("/lavasplash/users.html", url = urlrev, Oferta_Servicio = DatosOfServicioOftado)
def Servicios(id): urlrev = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect=Model(username) wid = id TablaServicioAutomotor = dict() TablaServicioAutomotor = {'TABLE':'servicio', 'Col1':'id', 'Col2':'tipo', 'Col3':'costo', 'Col4':'detalles', 'Col5':'automotor', 'Whe6':'automotor=%s' } Data = (wid,) DatosServicioV = connect.SW_TABLE(username,TablaServicioAutomotor, Data) return render_template("/lavasplash/Servicios.html", url = urlrev, Oferta_Servicio = DatosServicioV)
def palabra(): Urlbase = URLBASE username = CONFIG['TYPE_USER']['ROOT'] connect = Model(username) req = request.get_json() wid = req["nro_crucigrama"] #wid = "1" TSSPalabras = {'TABLE': 'crucigrama', 'Col1': 'palabras', 'Whe2': 'id=%s'} Data = (wid, ) EnCrucigrama = connect.SW_TABLE(username, TSSPalabras, Data) cx = "*" Total_palabras = EnCrucigrama[0]["palabras"] palabra = req["palabra"] cx += palabra acierto = True for item in req["coordenadas"]: coord = req["coordenadas"][item] cx += coord mtrix_palabras = Total_palabras.split("*") palabras_in_crucigrama = "" x_palabra = cx.strip("*") if x_palabra in mtrix_palabras: acierto = True else: acierto = False if (acierto): result = { "palabra": req["palabra"], "coordenadas": req["coordenadas"], "acierto": True } else: result = { "palabra": req["palabra"], "coordenadas": req["coordenadas"], "acierto": False } res = make_response(jsonify({"message": "OK"}), 200) return result