replacement of configuration variable acquisition
This commit is contained in:
parent
2b04397f7d
commit
3da7b70cd1
@ -15,18 +15,18 @@ bcrypt = Bcrypt(app)
|
||||
#### Variables ####################################################################################
|
||||
|
||||
bcrypt = Bcrypt(app)
|
||||
DATAS_USER = app.config['DOSSIER_APP']
|
||||
DATAS_USER = app.config.get('DOSSIER_APP')
|
||||
|
||||
extensionimg = app.config['EXT_IMG']
|
||||
extensionimg = app.config.get('EXT_IMG')
|
||||
|
||||
DATABASE = app.config['DATABASE']
|
||||
BASE_URL = app.config['BASE_URL']
|
||||
SETUID = app.config['SETUID']
|
||||
MAIL_SERVER = app.config['MAIL_SERVER']
|
||||
XMPP_SERVER = app.config['XMPP_SERVER']
|
||||
BACKUP_TIME = app.config['BACKUP_TIME']
|
||||
SERVER_TITLE = app.config['TITLE_SERVER']
|
||||
SERVER_DESC = app.config['DESC_SERVER']
|
||||
DATABASE = app.config.get('DATABASE')
|
||||
BASE_URL = app.config.get('BASE_URL')
|
||||
SETUID = app.config.get('SETUID')
|
||||
MAIL_SERVER = app.config.get('MAIL_SERVER')
|
||||
XMPP_SERVER = app.config.get('XMPP_SERVER')
|
||||
BACKUP_TIME = app.config.get('BACKUP_TIME')
|
||||
SERVER_TITLE = app.config.get('TITLE_SERVER')
|
||||
SERVER_DESC = app.config.get('DESC_SERVER')
|
||||
##################################################################################################
|
||||
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@ from socket import gethostname
|
||||
from flask_bcrypt import Bcrypt
|
||||
from tools.utils import email_disp, append_to_log, gen_token, valid_passwd, valid_token_register, get_user_by_token, totp_is_valid, login_required
|
||||
from pyotp import random_base32
|
||||
from tools.filesutils import check_and_create
|
||||
import qrcode
|
||||
|
||||
|
||||
@ -23,17 +24,17 @@ app.config.from_pyfile('config.py')
|
||||
#### Variables ####################################################################################
|
||||
|
||||
bcrypt = Bcrypt(app)
|
||||
DOSSIER_PERSO = app.config['DOSSIER_APP']
|
||||
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']
|
||||
BACKUP_TIME = app.config['BACKUP_TIME']
|
||||
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')
|
||||
BACKUP_TIME = app.config.get('BACKUP_TIME')
|
||||
|
||||
##################################################################################################
|
||||
|
||||
@ -49,6 +50,7 @@ def profil_img(user, img) :
|
||||
@login_required
|
||||
def profile() :
|
||||
user='%s' % escape(session['username'])
|
||||
check_and_create(os.path.join(DOSSIER_PERSO, user,'profile'))
|
||||
conn = sqlite3.connect(DATABASE) # Connexion à la base de donnée
|
||||
cursor = conn.cursor() # Création de l'objet "curseur"
|
||||
cursor.execute("""SELECT avatar, nom, prenom, age, Mail_rescue FROM users WHERE name=?""", (user,))
|
||||
@ -68,7 +70,7 @@ def profile() :
|
||||
|
||||
if request.form['theme'] != "Default":
|
||||
copy( "static/vendors/picocss/pico.fluid.classless."+request.form['theme']+".min.css",
|
||||
DOSSIER_PERSO+ user +'/theme.min.css' )
|
||||
os.path.join(DOSSIER_PERSO, user ,'theme.min.css') )
|
||||
|
||||
if request.form['nom']:
|
||||
profil_user['nom'] = request.form['nom']
|
||||
@ -85,11 +87,11 @@ def profile() :
|
||||
flash(u'Adresse de courriel de secour invalide', 'error')
|
||||
if f: # On vérifie qu'un fichier a bien été envoyé
|
||||
nom = secure_filename(f.filename)
|
||||
f.save(DOSSIER_PERSO + user + '/profile/' + nom)
|
||||
image = DOSSIER_PERSO + user + '/profile/' + nom
|
||||
f.save(os.path.join(DOSSIER_PERSO, user, 'profile', nom))
|
||||
image = os.path.join(DOSSIER_PERSO, user, 'profile', nom)
|
||||
with Image.open(image) as img:
|
||||
img.thumbnail((300,200))
|
||||
img.save( DOSSIER_PERSO + user + '/profile/' + nom)
|
||||
img.save(os.path.join(DOSSIER_PERSO, user, 'profile', nom))
|
||||
filename = nom
|
||||
conn = sqlite3.connect(DATABASE) # Connexion à la base de donnée
|
||||
cursor = conn.cursor() # Création de l'objet "curseur"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user