Created
February 26, 2024 14:22
-
-
Save dario61081/f810593eb5e12f36fc5e970aec0d2352 to your computer and use it in GitHub Desktop.
mensajes del sistema
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import flash, session | |
from core.logs import logger | |
str_message_success = 'Operación ejecutada con exito' | |
str_message_error = 'Ha ocurrido un error al ejecutar la operación' | |
def success_message(msg: str = None): | |
"""Show positive flash message""" | |
if not msg: | |
msg = str_message_success | |
flash(msg, 'success') | |
logger.info(msg, user=session.get('username'), source="messages") | |
def error_message(msg: str = None): | |
"""Show negative flash message""" | |
if not msg: | |
msg = str_message_error | |
flash(msg, 'danger') | |
logger.error(msg, user=session.get('username'), source="messages") | |
def alert_message(msg: str = None): | |
"""Show alert flash message""" | |
flash(msg, 'warning') | |
logger.info(msg, user=session.get('username'), source="messages") | |
def info_message(msg: str = None): | |
"""Show message flash message""" | |
flash(msg, 'info') | |
logger.info(msg, user=session.get('username'), source="messages") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment