Fixes for fix a warning about registering blueprints

This commit is contained in:
Antonio de la Rosa 2021-06-28 14:49:01 +02:00
parent 8c2bcdc74a
commit dfbdc7109f
4 changed files with 25 additions and 13 deletions

View file

@ -43,6 +43,8 @@ def start_app():
dir_controllers=os.listdir(controller_base)
app_name=getattr(controller_path, added_app[1])
for controller in dir_controllers:
if controller.find('.py')!=-1 and controller.find('__init__')==-1:
@ -53,12 +55,9 @@ def start_app():
a=import_module(module_app)
app_name=getattr(a, added_app[1])
app.register_blueprint(app_name, url_prefix=added_app[2])
arr_module_path[key_app]=os.path.dirname(sys.modules[module_app].__file__)
app.register_blueprint(app_name, url_prefix=added_app[2])
"""
module_app=config.apps[added_app][0]

View file

@ -36,9 +36,11 @@ class SendMail:
else:
self.context = ssl_module.SSLContext(ssl_module.PROTOCOL_TLS)
if self.ssl==True:
def connect(self):
self.smtp=smtplib.SMTP(host=self.host, port=self.port)
self.smtp=smtplib.SMTP(host=self.host, port=self.port)
if self.ssl==True:
try:
@ -62,9 +64,10 @@ class SendMail:
return False
#login
if self.username!='':
if self.smtp!=None:
try:
@ -88,8 +91,14 @@ class SendMail:
return False
return True
def send(self, from_address, to_address: list, subject, message, content_type='plain', attachments=[]):
if self.smtp==None:
if not self.connect():
return False
COMMASPACE=', '
if len(attachments)==0:
@ -168,6 +177,7 @@ class SendMail:
if self.smtp!=None:
self.smtp.quit()
self.smtp=None
def __del__(self):

View file

@ -0,0 +1,4 @@
from flask import Blueprint, redirect
welcome_app=Blueprint('welcome_app', __name__)

View file

@ -1,13 +1,12 @@
from flask import Blueprint, redirect
from settings import config
from paramecio2.libraries.mtemplates import PTemplate, env_theme
from paramecio2.modules.welcome import welcome_app
env=env_theme(__file__)
t=PTemplate(env)
welcome_app=Blueprint('welcome_app', __name__)
@welcome_app.route('/welcome')
def home():