Browse Source

new stuff

master
Cristina Cochior 6 years ago
parent
commit
7f455de9ae
  1. BIN
      __pycache__/contextualise.cpython-36.pyc
  2. 19
      contextualise.py

BIN
__pycache__/contextualise.cpython-36.pyc

Binary file not shown.

19
contextualise.py

@ -26,10 +26,6 @@ listofdicts=[] #to be able to import and use json content
datafromjson = [] datafromjson = []
#test getting json file from id
id = "17"
jsonfilefordescription = "files/"+id+"/"+id+".json"
#arrays with the user path of words and numbers #arrays with the user path of words and numbers
pathofwords = [] pathofwords = []
pathofnumbers = [] pathofnumbers = []
@ -71,10 +67,10 @@ print("-------------------------")
dict = {} #dict for the form entries dict = {} #dict for the form entries
with open("static/"+jsonfilefordescription, 'r') as f: # with open("static/"+jsonfilefordescription, 'r') as f:
data_dict = json.load(f) # data_dict = json.load(f)
datafromjson = data_dict["files"] # datafromjson = data_dict["files"]
print(datafromjson) # print(datafromjson)
@app.route("/") @app.route("/")
def home(): def home():
@ -95,6 +91,11 @@ def all():
@app.route('/description') @app.route('/description')
def 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 #open json file, list filepaths in array and loop with thefile
textfile="" textfile=""
with open("static/"+jsonfilefordescription, 'r') as f: with open("static/"+jsonfilefordescription, 'r') as f:
@ -111,7 +112,7 @@ def description():
textfile = Markup(textfile) 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']) @app.route('/diverge', methods=['GET'])
def diverge(): def diverge():

Loading…
Cancel
Save