diff --git a/__pycache__/contextualise.cpython-36.pyc b/__pycache__/contextualise.cpython-36.pyc index fb862db..c236f3a 100644 Binary files a/__pycache__/contextualise.cpython-36.pyc and b/__pycache__/contextualise.cpython-36.pyc differ diff --git a/contextualise.py b/contextualise.py index ecfe83c..2a0706c 100644 --- a/contextualise.py +++ b/contextualise.py @@ -26,10 +26,6 @@ listofdicts=[] #to be able to import and use json content datafromjson = [] -#test getting json file from id -id = "17" -jsonfilefordescription = "files/"+id+"/"+id+".json" - #arrays with the user path of words and numbers pathofwords = [] pathofnumbers = [] @@ -71,10 +67,10 @@ print("-------------------------") dict = {} #dict for the form entries -with open("static/"+jsonfilefordescription, 'r') as f: - data_dict = json.load(f) - datafromjson = data_dict["files"] -print(datafromjson) +# with open("static/"+jsonfilefordescription, 'r') as f: +# data_dict = json.load(f) +# datafromjson = data_dict["files"] +# print(datafromjson) @app.route("/") def home(): @@ -95,6 +91,11 @@ def all(): @app.route('/description') def description(): + idno=request.args.get('id') + jsonfilefordescription = "files/"+idno+"/"+idno+".json" + with open("static/"+jsonfilefordescription, 'r') as f: + data_dict = json.load(f) + datafromjson = data_dict["files"] #open json file, list filepaths in array and loop with thefile textfile="" with open("static/"+jsonfilefordescription, 'r') as f: @@ -111,7 +112,7 @@ def description(): textfile = Markup(textfile) - return render_template('description.html', datafromjson=datafromjson, itemid=itemid, textfile=textfile) + return render_template('description.html', datafromjson=datafromjson, itemid=itemid, textfile=textfile, idno=idno) @app.route('/diverge', methods=['GET']) def diverge():