@webauth.SecurityCheck
def RenderHelp(request, path, document_root=None, content_type=None):
  """Either serves local help files or redirects to the remote ones."""
  _ = document_root
  _ = content_type

  request.REQ = request.REQUEST

  help_path = request.path.split("/", 2)[-1]
  if not help_path:
    return AccessDenied("Error: Invalid help path.")

  try:
    user_record = aff4.FACTORY.Open(
        aff4.ROOT_URN.Add("users").Add(request.user), "GRRUser",
        token=BuildToken(request, 60))

    settings = user_record.Get(user_record.Schema.GUI_SETTINGS)
  except __HOLE__:
    settings = aff4.GRRUser.SchemaCls.GUI_SETTINGS()

  if settings.docs_location == settings.DocsLocation.REMOTE:
    # Proxy remote documentation.
    return RedirectToRemoteHelp(help_path)
  else:
    # Serve prebuilt docs using static handler. To do that we have
    # to resolve static handler's name to an actual function object.
    static_handler_components = urls.static_handler.split(".")
    static_handler_module = importlib.import_module(".".join(
        static_handler_components[0:-1]))
    static_handler = getattr(static_handler_module,
                             static_handler_components[-1])
    return static_handler(
        request, path, document_root=config_lib.CONFIG["AdminUI.help_root"])
dataset/ETHPy150Open google/grr/grr/gui/views.py/RenderHelp