From 7e5c437b7c2b3f32ed4bd47aade921596ef5a6ee Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Tue, 22 Aug 2017 12:05:38 +0200 Subject: fixed some things --- lib/web.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lib/web.py') diff --git a/lib/web.py b/lib/web.py index 69522f8..bbad99d 100644 --- a/lib/web.py +++ b/lib/web.py @@ -1,11 +1,21 @@ from flask import Flask, render_template -from .classes import r +from .config import config app = Flask(__name__) @app.route("/") def hello(): - lista = r.zrange('todo', 0, -1) + with open(config['path'], 'rb') as fout: + try: + lines = fout.readlines() + except: + lines = '' + + if lines is not None: + lista = [x.strip() for i, x in enumerate(lines) if i > 0] + else: + lista = [] + try: return render_template("index.html", list_todo = lista, len_todo = len(lista)) except Exception as e: -- cgit v1.2.3-18-g5258