- return direct_to_template(request, 'explorer/file_xml.html', extra_context={
- 'hash': path,
- 'form': form,
- })
-
-
-def file_html(request, path):
- return direct_to_template(request, 'explorer/file_html.html', extra_context={
- 'object': html.transform(repo.get_file(path).data(), is_file=False),
- 'hash': path,
- })
-
\ No newline at end of file
+ output = document_html_resource.handler.read(request, **kwargs)
+
+ if isinstance(output, HttpResponse):
+ # errors = json.loads(output.content)
+ output.mimetype = "text/plain"
+ return output
+
+ return direct_to_template(request, 'html4print.html',
+ extra_context={'output': output, 'docid': kwargs['docid']},
+ mimetype="text/html" )
+
+
+def _add_references(message, issues):
+ return message + " - " + ", ".join(map(lambda issue: "Refs #%d" % issue['id'], issues))
+
+def _get_issues_for_file(fileid):
+ uf = None
+ try:
+ uf = urllib2.urlopen(settings.REDMINE_URL + 'publications/issues/%s.json' % fileid)
+ return json.loads(uf.read())
+ except urllib2.HTTPError:
+ return []
+ finally:
+ if uf: uf.close()
+
+# =================
+# = Pull requests =
+# =================
+def pull_requests(request):
+ objects = PullRequest.objects.order_by('-status', 'timestamp')
+
+ if not request.user.has_perm('explorer.book.can_share'):
+ objects = objects.filter(comitter=request.user)
+
+ return direct_to_template(request, 'manager/pull_request.html',
+ extra_context = {'objects': objects} )
+
+
+#
+# Testing
+#
+def renderer_test(request):
+ return direct_to_template(request, 'renderer.html', mimetype="text/html",
+ extra_context = {} )