From 2b04397f7d64817f970beb7a3a7df44f0c53693b Mon Sep 17 00:00:00 2001 From: kitoy Date: Sat, 10 Jan 2026 01:04:38 +0100 Subject: [PATCH] replacement of configuration variable acquisition --- views/mymailbox.py | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/views/mymailbox.py b/views/mymailbox.py index 2f5f7a3..fb8b713 100644 --- a/views/mymailbox.py +++ b/views/mymailbox.py @@ -17,19 +17,19 @@ app = Flask( 'pywallter' ) app.config.from_pyfile('config.py') -#### Variables #################################################################################### -DOSSIER_PERSO = app.config['DOSSIER_APP'] +#### Variables ################################################################################### +DOSSIER_PERSO = app.config.get('DOSSIER_APP') -extensionimg = app.config['EXT_IMG'] +extensionimg = app.config.get('EXT_IMG') -DATABASE = app.config['DATABASE'] -DATAS_USER = app.config['DOSSIER_APP'] -MAIL_SERVER = app.config['MAIL_SERVER'] -XMPP_SERVER = app.config['XMPP_SERVER'] -SETUID = app.config['SETUID'] -BASE_URL = app.config['BASE_URL'] -MAIL_WEBSERVICE = app.config['MAIL_WEBSERVICE'] -XMPP_WEBSERVICE = app.config['XMPP_WEBSERVICE'] +DATABASE = app.config.get('DATABASE') +DATAS_USER = app.config.get('DOSSIER_APP') +MAIL_SERVER = app.config.get('MAIL_SERVER') +XMPP_SERVER = app.config.get('XMPP_SERVER') +SETUID = app.config.get('SETUID') +BASE_URL = app.config.get('BASE_URL') +MAIL_WEBSERVICE = app.config.get('MAIL_WEBSERVICE') +XMPP_WEBSERVICE = app.config.get('XMPP_WEBSERVICE') ################################################################################################## @@ -49,12 +49,13 @@ def mymessaging(): myemail = tmp[0] + return render_template('mymessaging.html', section="mymessaging", hostname=hostname, myemail=myemail, - imap_address=app.config['IMAP_ADDRESS'], - smtp_address=app.config['SMTP_ADDRESS'], + imap_address=app.config.get('IMAP_ADDRESS'), + smtp_address=app.config.get('SMTP_ADDRESS'), mail_server=MAIL_SERVER, mail_webservice=MAIL_WEBSERVICE, xmpp_server=XMPP_SERVER, @@ -65,8 +66,6 @@ def mymessaging(): @mymailbox.route('/mymailbox/alias', methods=['GET', 'POST'] ) @login_required def myalias(): - - hostname = set_mail_domain() user='%s' % escape(session['username']) conn = sqlite3.connect(DATABASE) # Connexion à la base de donnée