switch to individual parsing of data
allows for exceptions like authors, date, etc. will hopefully switch back as soon as I figure out a generic way to do so
This commit is contained in:
parent
1a085b68c5
commit
2228672a16
11
test.py
11
test.py
|
@ -19,9 +19,14 @@ def main():
|
||||||
|
|
||||||
for book in collection.iter(ns + "entry"):
|
for book in collection.iter(ns + "entry"):
|
||||||
bookout = {}
|
bookout = {}
|
||||||
for datum in data:
|
bookout["title"] = book.find(ns + "title").text if (book.find(ns + "title") != None) else ""
|
||||||
d = book.find(ns + datum)
|
bookout["isbn"] = book.find(ns + "isbn").text if (book.find(ns + "isbn") != None) else ""
|
||||||
bookout[datum] = d.text if (d != None) else ""
|
authors = []
|
||||||
|
if book.find(ns + "authors") != None:
|
||||||
|
for a in book.find(ns + "authors"):
|
||||||
|
authors.append(a.text)
|
||||||
|
bookout["authors"] = "; ".join(authors)
|
||||||
|
|
||||||
out.append(bookout.copy())
|
out.append(bookout.copy())
|
||||||
return render_template("books.html", books = out, data = data)
|
return render_template("books.html", books = out, data = data)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue