-def folder_images(request, folder):
- return direct_to_template(request, 'explorer/folder_images.html', extra_context={
- 'images': models.get_images_from_folder(folder),
- })
+ 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)