Browse Source

some things new

master
Cristina Cochior 6 years ago
parent
commit
eddde7023c
  1. BIN
      __pycache__/contextualise.cpython-37.pyc
  2. 31
      contextualise.py

BIN
__pycache__/contextualise.cpython-37.pyc

Binary file not shown.

31
contextualise.py

@ -20,7 +20,7 @@ app.config.from_object(Config)
######################################################################################
# setting variables for holding paths, folder names and the one file for description
path = "static/files/"
path = "/static/files/"
jsonfiles = [] #json files
fullpathjsonfiles = [] #fullpath for some situations
listingfiles= [] #fullpaths
@ -68,17 +68,16 @@ with open('wordlist.json', 'r', encoding='utf8') as f:
wordlist_dict = json.load(f)
#listing paths and files, not in order but well...
for path, subdirs, files in os.walk(path):
for name in files:
#excluding json files from listing :-)
if not name.endswith(".json") and not name.endswith(".DS_Store"):
fullpath = os.path.join(path, name)
listingdirectories.append(path)
listingfiles.append(fullpath[7:]) #fullpaths minus static/
if name.endswith(".json"):
fullpath = os.path.join(path, name)
jsonfiles.append(fullpath[7:])
# for path, subdirs, files in os.walk(path):
# for name in files:
# if not name.endswith(".json") and not name.endswith(".DS_Store"):
# fullpath = os.path.join(path, name)
# listingdirectories.append(path)
# listingfiles.append(fullpath[7:]) #fullpaths minus static/
#
# if name.endswith(".json"):
# fullpath = os.path.join(path, name)
# jsonfiles.append(fullpath[7:])
#listing the json paths simultaneously generating a new index.json for the navbar
@ -92,11 +91,11 @@ for path, subdirs, files in os.walk('./static/files/'):
temp_dict = json.load(f)
index_dict[temp_dict["id"]] = temp_dict["title"]
dict = {} #dict for the form entries
with open("static/"+jsonfiles[4], 'r') as f:
data_dict = json.load(f)
datafromjson = data_dict["files"]
# with open("static/"+jsonfiles[4], 'r') as f:
# data_dict = json.load(f)
# datafromjson = data_dict["files"]
######################################################################################
#NOW THE REAL DEAL

Loading…
Cancel
Save