Commit 1c78d8a7 authored by Kivou's avatar Kivou
Browse files

python3.5

parent 3c891de1
......@@ -75,8 +75,8 @@ def get_biblio_structure(structure_name, structure_id, n_publi=100):
publis = requests.get(req).json()
def write_from_publi(publis, n):
with open(f"biblio_{structure_name}-{n}.html", 'w') as f:
print(f"write {structure_name} {n}")
with open("biblio_{}-{}.html", 'w'.format(structure_name, n)) as f:
print("write {} {}".format(structure_name, n))
f.write('<html>\n')
f.write('\t<head>\n')
f.write('\t\t<meta charset="UTF-8">\n')
......@@ -89,7 +89,7 @@ def get_biblio_structure(structure_name, structure_id, n_publi=100):
f.write('\t<body>\n')
f.write('\t\t<div id="contenu-encadres"><div class="liste-chevron"><ul>\n')
for publi in publis["response"]["docs"][:n]:
f.write(f'\t\t\t<li>{html_publi(publi)}</li>\n')
f.write('\t\t\t<li>{}</li>\n'.format(html_publi(publi)))
f.write('\t\t</ul></div></div>\n')
f.write('\t</body>\n')
f.write('</html>')
......@@ -118,8 +118,8 @@ def get_biblio_idhal(idhal, n_publi=100):
publis_by_type[type] = [publi]
# return render(request, 'publi.html', context)
with open(f"biblio_{idhal}.html", 'w') as f:
print(f"write {idhal}")
with open("biblio_{}.html".format(idhal), 'w') as f:
print("write {}".format(idhal))
f.write('<html>\n')
f.write('\t<head>\n')
f.write('\t\t<meta charset="UTF-8">\n')
......@@ -132,13 +132,12 @@ def get_biblio_idhal(idhal, n_publi=100):
f.write('\t<body>\n')
f.write('\t\t<div id="contenu-encadres">\n')
for type, publis in publis_by_type.items():
f.write(f'\t\t<h2>{type}</h2>\n')
f.write('\t\t<h2>{}</h2>\n'.format(type))
f.write('\t\t<div><ul>\n')
for publi in publis[:n_publi]:
f.write(f'\t\t\t<li>{html_publi(publi)}</li>\n')
f.write('\t\t\t<li>{}</li>\n'.format(html_publi(publi)))
f.write('\t\t</ul></div>\n')
f.write('\t\t</div>\n')
f.write('\t</body>\n')
f.write('</html>')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment