-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
+
+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 = {} )