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"):
|
||||
bookout = {}
|
||||
for datum in data:
|
||||
d = book.find(ns + datum)
|
||||
bookout[datum] = d.text if (d != None) else ""
|
||||
bookout["title"] = book.find(ns + "title").text if (book.find(ns + "title") != None) else ""
|
||||
bookout["isbn"] = book.find(ns + "isbn").text if (book.find(ns + "isbn") != 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())
|
||||
return render_template("books.html", books = out, data = data)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user