def as_mind_map(request):
"""Provide a mind-map like representation of the table of ideas"""
for mimetype in request.GET.getall('mimetype'):
mimetype = mimetype
if mimetype in pygraphviz_formats:
break
else:
mimetype = request.accept.best_match(list(pygraphviz_formats.keys()))
if not mimetype:
raise HTTPNotAcceptable("Not known to pygraphviz: "+mimetype)
discussion = request.context._instance
G = discussion.as_mind_map()
G.layout(prog='twopi')
io = BytesIO()
G.draw(io, format=pygraphviz_formats[mimetype])
io.seek(0)
return Response(body_file=io, content_type=mimetype)
评论列表
文章目录