From f34eabd7df1ee32cd061851277e4a0f30ea8311a Mon Sep 17 00:00:00 2001 From: Chase Sterling Date: Sun, 4 Sep 2016 16:35:56 -0400 Subject: [PATCH] Viewing historical versions of pages now works, and show historical version of partials as well --- realms/modules/wiki/templates/wiki/page.html | 2 +- realms/modules/wiki/views.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/realms/modules/wiki/templates/wiki/page.html b/realms/modules/wiki/templates/wiki/page.html index 4529d23..167f113 100644 --- a/realms/modules/wiki/templates/wiki/page.html +++ b/realms/modules/wiki/templates/wiki/page.html @@ -23,7 +23,7 @@ {% block js %} {% endblock %} diff --git a/realms/modules/wiki/views.py b/realms/modules/wiki/views.py index 73eee22..480775b 100644 --- a/realms/modules/wiki/views.py +++ b/realms/modules/wiki/views.py @@ -23,7 +23,9 @@ def commit(name, sha): if not data: abort(404) - return render_template('wiki/page.html', name=name, page=data, commit=sha) + partials = _partials(data.imports, sha=sha) + + return render_template('wiki/page.html', name=name, page=data, commit=sha, partials=partials) @blueprint.route(r"/_compare//") @@ -118,14 +120,14 @@ def edit(name): sha=page.sha) -def _partials(imports): +def _partials(imports, sha='HEAD'): page_queue = collections.deque(imports) partials = collections.OrderedDict() while page_queue: page_name = page_queue.popleft() if page_name in partials: continue - page = g.current_wiki.get_page(page_name) + page = g.current_wiki.get_page(page_name, sha=sha) try: partials[page_name] = page.data except KeyError: