def view(request, app, path):

  path = _unquote_path(path)
  fs = get_help_fs(app)

  if fs.isdir(path):
    for i in INDEX_FILENAMES:
      tmp_path = os.path.join(path, i)
      if fs.isfile(tmp_path):
        path = tmp_path

  if not fs.isfile(path):
    raise PopupException("Could not find or read the file: %s (app %s)" % (path, app))

  content = fs.open(path, 'r').read()
  content = unicode(content, 'utf-8', errors='replace')
  if path.lower().endswith(".md"):
    content = ('<div class="print rendered-markdown">' +
               markdown.markdown(content, ['extra']) +
               '</div>')
  elif path.lower().endswith(".html"):
    content = '<div class="print">%s</div>' % (content,)
  else:
    # TODO(todd) escape content?
    content = '<pre>' + content + '</pre>'

  data = {
    'content': content,
    'apps': sorted([ x for x in appmanager.DESKTOP_MODULES if x.help_dir ],
      key = lambda app: app.menu_index),
    'title': appmanager.get_desktop_module(app).nice_name,
    'current': app
  }
  return render("display.mako", request, data)
Views and renders a file at a given path.
dataset/ETHPy150Open cloudera/hue/apps/help/src/help/views.py/view