categorias=get_diccionario_categorias(gestor_mysql) #print (categorias) categoria_actual=-1 boletin="" for f in filas_historias: categoria_fila=f[1] id=f[0] img=extraer_imagen(gestor_mysql, id) if categoria_fila!=categoria_actual: boletin+="<h1>" + categorias[categoria_fila] + "</h1>" categoria_actual=categoria_fila etiqueta=generar_fila_noticia(img, PLANTILLA_NOTICIA.format(f[0], MOSTRAR_IMAGEN)) boletin=boletin + etiqueta + "<br/>\r\n<br/>\r\n" fecha_hoy=gestor_fechas.convertir_fecha_de_iso_a_estandar(fecha_hoy) gf=GestorFicheros() valores_para_rellenar_plantilla=dict() valores_para_rellenar_plantilla["titulo"]=TITULO_BOLETIN.format ( fecha_hoy ) valores_para_rellenar_plantilla["fecha_hoy"]=fecha_hoy valores_para_rellenar_plantilla["fecha_semana_pasada"]=gestor_fechas.convertir_fecha_de_iso_a_estandar(fecha_hace_una_semana) valores_para_rellenar_plantilla["contenido"]=boletin texto_plantilla_rellenar=gf.rellenar_fichero_plantilla("plantilla_boletin.html", valores_para_rellenar_plantilla) texto_plantilla_rellenar=texto_plantilla_rellenar.replace("'", "\"") #print (texto_boletin) sql_insercion=SQL_INSERCION_BOLETIN.format ( texto_plantilla_rellenar,
#!/usr/bin/env python3 # coding=utf-8 import sys import utilidades import utilidades.email from utilidades.fechas.GestorFechas import GestorFechas from utilidades.excel.GestorExcel import EscritorExcel gf=GestorFechas() fecha_iso="2016-01-21" fecha_estandar=gf.convertir_fecha_de_iso_a_estandar(fecha_iso) print ("{0} transformado en {1}".format ( fecha_iso, fecha_estandar )) from utilidades.email.GestorEmail import GestorEmail gm=GestorEmail()