- - - - - - -
@@ -63,6 +49,5 @@ -
{% endblock %} diff --git a/views/blog.py b/views/blog.py index 921f546..5116522 100644 --- a/views/blog.py +++ b/views/blog.py @@ -32,7 +32,7 @@ def racine_blog(): UTILISATEUR='%s'% escape(session['username']) if request.method == 'POST': title= request.form['title'] - content = markdown(request.form['content']) + content = request.form['content'] #category = request.form['category'] status = request.form['status'] TIME=time.strftime("%A %d %B %Y %H:%M:%S") @@ -55,6 +55,8 @@ def racine_blog(): status=row[4], avatar=row[5], nom=row[6], prenom=row[7], age=row[8]) for row in reversed(cursor.fetchall())] conn.close() + for post in posts: + post['content'] = markdown(post['content']) return render_template('blog.html', section='Post-it', posts=posts) else: return redirect(BASE_URL, code=401) @@ -78,7 +80,7 @@ def edit(post): if 'username' in session : if request.method == 'POST' : newtitle = request.form['title'] - newcontent = markdown(request.form['content']) + newcontent = request.form['content'] newstatus = request.form['status'] conn = sqlite3.connect(DATABASE) cursor = conn.cursor() @@ -105,11 +107,13 @@ def viewsheet(): if 'username' in session: conn = sqlite3.connect(DATABASE) # Connexion à la base de donnée cursor = conn.cursor() # Création de l'objet "curseur" - cursor.execute("""SELECT title, content, time, author, status, avatar, nom, prenom, age FROM posts INNER JOIN users ON author = name""") + cursor.execute("""SELECT title, content, time, author, status, avatar, nom, prenom, age FROM posts INNER JOIN users where status='public' """) posts = [dict(title=row[0], content=row[1], time=row[2], author=row[3], status=row[4], avatar=row[5], nom=row[6], prenom=row[7], age=row[8]) for row in reversed(cursor.fetchall())] conn.close() + for post in posts: + post['content'] = markdown(post['content']) return render_template('board.html', section='Post-it', posts=posts) else: return redirect(BASE_URL, code=401) diff --git a/views/profil.py b/views/profil.py index ca86893..06c7a67 100644 --- a/views/profil.py +++ b/views/profil.py @@ -30,11 +30,11 @@ BASE_URL = app.config['BASE_URL'] ################################################################################################## -@profil.route( '/profil/', methods=['GET'] ) -def profil_img(img) : +@profil.route( '/profil//', methods=['GET'] ) +def profil_img(user, img) : if 'username' in session : - UTILISATEUR='%s' % escape(session['username']) - return send_from_directory( os.path.join(DOSSIER_PERSO, UTILISATEUR, 'profile'), img ) + + return send_from_directory( os.path.join(DOSSIER_PERSO, user, 'profile'), img ) else: return redirect(BASE_URL, code=401)