Skip to content

Commit

Permalink
Fixes issues with template names etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
seabrie committed Feb 18, 2015
1 parent a5b8128 commit dddf24a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
16 changes: 14 additions & 2 deletions clic/dickens/chapter_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,23 @@ def __init__(self):
self.qf = self.db.get_object(self.session, 'defaultQueryFactory')

def get_chapter(self, chapter_number, book):
""" Returns transformed XML for given chapter & book """
query = self.qf.get_query(self.session, 'c3.book-idx = "%s"' % book)
result_set = self.db.search(self.session, query)
chapter_ptr = result_set[chapter_number - 1]
chapter = chapter_ptr.fetch_record(self.session)
transformer = self.db.get_object(self.session, 'chapterView-Txr')
raw = transformer.process_record(self.session, chapter).get_raw(self.session)
return raw
formatted_chapter = transformer.process_record(self.session, chapter).get_raw(self.session)
for b in booklist:
if (b[0][0] == book):
book_title = b[0][1]
return formatted_chapter, book_title

def get_raw_chapter(self, chapter_number, book):
""" Returns raw chapter XML for given chapter & book """
query = self.qf.get_query(self.session, 'c3.book-idx = "%s"' % book)
result_set = self.db.search(self.session, query)
chapter_ptr = result_set[chapter_number - 1]
chapter = chapter_ptr.fetch_record(self.session)
return chapter.get_dom(self.session)

2 changes: 1 addition & 1 deletion clic/dickens/web/flask/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def concordances():
def chapterView(number, book):
chapterRepository = Chapter_Repository()
chapter, book_title = chapterRepository.get_chapter(number, book)
return render_template("chapterview.html", (content=chapter, book_title=book_title))
return render_template("chapter-view.html", content=chapter, book_title=book_title)

#@cache.cache('keywords', expire=3600) ## expires after 3600 secs
def fetchKeywords(args):
Expand Down
1 change: 1 addition & 0 deletions clic/dickens/web/flask/templates/chapter-view.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
{% endblock %}

{% block body %}
<h2>{{ book_title }}</h2>
{{ content|safe }}
{% endblock %}

0 comments on commit dddf24a

Please sign in to comment.