def _dogsave(request,graphName):
  profile = getProfile(request,allowDefault=False)
  if not profile: return stderr("You must be logged in to save graphs")
  url = request.GET.get('url')
  if not url: return stderr("No url specified!")
  try:
    existingGraph = profile.mygraph_set.get(name=graphName)
    existingGraph.url = url
    existingGraph.save()
  except __HOLE__:
    try:
      newGraph = MyGraph(profile=profile,name=graphName,url=url)
      newGraph.save()
    except:
      log.exception("Failed to create new MyGraph in _dogsave(), graphName=%s" % graphName)
      return stderr("Failed to save graph %s" % graphName)
  return stdout("Saved graph %s" % graphName)
dataset/ETHPy150Open tmm1/graphite/webapp/graphite/cli/commands.py/_dogsave