コード例 #1
0
ファイル: views.py プロジェクト: Squarespace/graphite-web
def parseOptions(request):
  queryParams = request.REQUEST

  # Start with some defaults
  graphOptions = {'width' : 330, 'height' : 250}
  requestOptions = {}

  graphType = queryParams.get('graphType','line')
  assert graphType in GraphTypes, "Invalid graphType '%s', must be one of %s" % (graphType,GraphTypes.keys())
  graphClass = GraphTypes[graphType]

  # Fill in the requestOptions
  requestOptions['graphType'] = graphType
  requestOptions['graphClass'] = graphClass
  requestOptions['pieMode'] = queryParams.get('pieMode', 'average')
  requestOptions['cacheTimeout'] = int( queryParams.get('cacheTimeout', settings.DEFAULT_CACHE_DURATION) )
  requestOptions['targets'] = []

  # Extract the targets out of the queryParams
  mytargets = []
  # Normal format: ?target=path.1&target=path.2
  if len(queryParams.getlist('target')) > 0:
    mytargets = queryParams.getlist('target')

  # Rails/PHP/jQuery common practice format: ?target[]=path.1&target[]=path.2
  elif len(queryParams.getlist('target[]')) > 0:
    mytargets = queryParams.getlist('target[]')

  # Collect the targets
  for target in mytargets:
    requestOptions['targets'].append(target)

  template = dict()
  for key, val in queryParams.items():
    if key.startswith("template["):
      template[key[9:-1]] = val
  requestOptions['template'] = template

  if 'pickle' in queryParams:
    requestOptions['format'] = 'pickle'
  if 'rawData' in queryParams:
    requestOptions['format'] = 'raw'
  if 'format' in queryParams:
    requestOptions['format'] = queryParams['format']
    if 'jsonp' in queryParams:
      requestOptions['jsonp'] = queryParams['jsonp']
  if 'noCache' in queryParams:
    requestOptions['noCache'] = True
  if 'maxDataPoints' in queryParams and queryParams['maxDataPoints'].isdigit():
    requestOptions['maxDataPoints'] = int(queryParams['maxDataPoints'])

  requestOptions['localOnly'] = queryParams.get('local') == '1'

  # Fill in the graphOptions
  for opt in graphClass.customizable:
    if opt in queryParams:
      val = queryParams[opt]
      if (val.isdigit() or (val.startswith('-') and val[1:].isdigit())) and 'color' not in opt.lower():
        val = int(val)
      elif '.' in val and (val.replace('.','',1).isdigit() or (val.startswith('-') and val[1:].replace('.','',1).isdigit())):
        val = float(val)
      elif val.lower() in ('true','false'):
        val = val.lower() == 'true'
      elif val.lower() == 'default' or val == '':
        continue
      graphOptions[opt] = val

  tzinfo = pytz.timezone(settings.TIME_ZONE)
  if 'tz' in queryParams:
    try:
      tzinfo = pytz.timezone(queryParams['tz'])
    except pytz.UnknownTimeZoneError:
      pass
  requestOptions['tzinfo'] = tzinfo

  # Get the time interval for time-oriented graph types
  if graphType == 'line' or graphType == 'pie':
    if 'until' in queryParams:
      untilTime = parseATTime(queryParams['until'], tzinfo)
    else:
      untilTime = parseATTime('now', tzinfo)
    if 'from' in queryParams:
      fromTime = parseATTime(queryParams['from'], tzinfo)
    else:
      fromTime = parseATTime('-1d', tzinfo)

    startTime = min(fromTime, untilTime)
    endTime = max(fromTime, untilTime)
    assert startTime != endTime, "Invalid empty time range"

    requestOptions['startTime'] = startTime
    requestOptions['endTime'] = endTime
    timeRange = endTime - startTime
    queryTime = timeRange.days * 86400 + timeRange.seconds # convert the time delta to seconds
    if settings.DEFAULT_CACHE_POLICY and not queryParams.get('cacheTimeout'):
      requestOptions['cacheTimeout'] = max(timeout for period,timeout in settings.DEFAULT_CACHE_POLICY if period <= queryTime)

  return (graphOptions, requestOptions)
コード例 #2
0
ファイル: views.py プロジェクト: gpurkins-ias/graphite-web
def parseOptions(request):
    queryParams = request.GET.copy()
    queryParams.update(request.POST)

    # Start with some defaults
    graphOptions = {"width": 330, "height": 250}
    requestOptions = {}

    graphType = queryParams.get("graphType", "line")
    assert graphType in GraphTypes, "Invalid graphType '%s', must be one of %s" % (graphType, GraphTypes.keys())
    graphClass = GraphTypes[graphType]

    # Fill in the requestOptions
    requestOptions["graphType"] = graphType
    requestOptions["graphClass"] = graphClass
    requestOptions["pieMode"] = queryParams.get("pieMode", "average")
    requestOptions["cacheTimeout"] = int(queryParams.get("cacheTimeout", settings.DEFAULT_CACHE_DURATION))
    requestOptions["targets"] = []

    # Extract the targets out of the queryParams
    mytargets = []
    # Normal format: ?target=path.1&target=path.2
    if len(queryParams.getlist("target")) > 0:
        mytargets = queryParams.getlist("target")

    # Rails/PHP/jQuery common practice format: ?target[]=path.1&target[]=path.2
    elif len(queryParams.getlist("target[]")) > 0:
        mytargets = queryParams.getlist("target[]")

    # Collect the targets
    for target in mytargets:
        requestOptions["targets"].append(target)

    template = dict()
    for key, val in queryParams.items():
        if key.startswith("template["):
            template[key[9:-1]] = val
    requestOptions["template"] = template

    if "pickle" in queryParams:
        requestOptions["format"] = "pickle"
    if "rawData" in queryParams:
        requestOptions["format"] = "raw"
    if "format" in queryParams:
        requestOptions["format"] = queryParams["format"]
        if "jsonp" in queryParams:
            requestOptions["jsonp"] = queryParams["jsonp"]
    if "noCache" in queryParams:
        requestOptions["noCache"] = True
    if "maxDataPoints" in queryParams and queryParams["maxDataPoints"].isdigit():
        requestOptions["maxDataPoints"] = int(queryParams["maxDataPoints"])

    requestOptions["localOnly"] = queryParams.get("local") == "1"

    # Fill in the graphOptions
    for opt in graphClass.customizable:
        if opt in queryParams:
            val = queryParams[opt]
            if (val.isdigit() or (val.startswith("-") and val[1:].isdigit())) and "color" not in opt.lower():
                val = int(val)
            elif "." in val and (
                val.replace(".", "", 1).isdigit() or (val.startswith("-") and val[1:].replace(".", "", 1).isdigit())
            ):
                val = float(val)
            elif val.lower() in ("true", "false"):
                val = val.lower() == "true"
            elif val.lower() == "default" or val == "":
                continue
            graphOptions[opt] = val

    tzinfo = pytz.timezone(settings.TIME_ZONE)
    if "tz" in queryParams:
        try:
            tzinfo = pytz.timezone(queryParams["tz"])
        except pytz.UnknownTimeZoneError:
            pass
    requestOptions["tzinfo"] = tzinfo

    # Get the time interval for time-oriented graph types
    if graphType == "line" or graphType == "pie":
        if "until" in queryParams:
            untilTime = parseATTime(queryParams["until"], tzinfo)
        else:
            untilTime = parseATTime("now", tzinfo)
        if "from" in queryParams:
            fromTime = parseATTime(queryParams["from"], tzinfo)
        else:
            fromTime = parseATTime("-1d", tzinfo)

        startTime = min(fromTime, untilTime)
        endTime = max(fromTime, untilTime)
        assert startTime != endTime, "Invalid empty time range"

        requestOptions["startTime"] = startTime
        requestOptions["endTime"] = endTime
        timeRange = endTime - startTime
        queryTime = timeRange.days * 86400 + timeRange.seconds  # convert the time delta to seconds
        if settings.DEFAULT_CACHE_POLICY and not queryParams.get("cacheTimeout"):
            requestOptions["cacheTimeout"] = max(
                timeout for period, timeout in settings.DEFAULT_CACHE_POLICY if period <= queryTime
            )

    return (graphOptions, requestOptions)
コード例 #3
0
ファイル: views.py プロジェクト: vbichov/graphite-web
def parseOptions(request):
    queryParams = request.GET.copy()
    queryParams.update(request.POST)

    # Start with some defaults
    graphOptions = {'width': 330, 'height': 250}
    requestOptions = {}

    graphType = queryParams.get('graphType', 'line')
    assert graphType in GraphTypes, "Invalid graphType '%s', must be one of %s" % (
        graphType, GraphTypes.keys())
    graphClass = GraphTypes[graphType]

    # Fill in the requestOptions
    requestOptions['graphType'] = graphType
    requestOptions['graphClass'] = graphClass
    requestOptions['pieMode'] = queryParams.get('pieMode', 'average')
    cacheTimeout = int(
        queryParams.get('cacheTimeout', settings.DEFAULT_CACHE_DURATION))
    requestOptions['targets'] = []

    # Extract the targets out of the queryParams
    mytargets = []
    # Normal format: ?target=path.1&target=path.2
    if len(queryParams.getlist('target')) > 0:
        mytargets = queryParams.getlist('target')

    # Rails/PHP/jQuery common practice format: ?target[]=path.1&target[]=path.2
    elif len(queryParams.getlist('target[]')) > 0:
        mytargets = queryParams.getlist('target[]')

    # Collect the targets
    for target in mytargets:
        requestOptions['targets'].append(target)

    template = dict()
    for key, val in queryParams.items():
        if key.startswith("template["):
            template[key[9:-1]] = val
    requestOptions['template'] = template

    if 'pickle' in queryParams:
        requestOptions['format'] = 'pickle'
    if 'rawData' in queryParams:
        requestOptions['format'] = 'raw'
    if 'format' in queryParams:
        requestOptions['format'] = queryParams['format']
        if 'jsonp' in queryParams:
            requestOptions['jsonp'] = queryParams['jsonp']

    requestOptions['pretty'] = bool(queryParams.get('pretty'))

    if 'noCache' in queryParams:
        requestOptions['noCache'] = True
    if 'maxDataPoints' in queryParams and queryParams['maxDataPoints'].isdigit(
    ):
        requestOptions['maxDataPoints'] = int(queryParams['maxDataPoints'])
    if 'noNullPoints' in queryParams:
        requestOptions['noNullPoints'] = True

    requestOptions['localOnly'] = queryParams.get('local') == '1'

    # Fill in the graphOptions
    for opt in graphClass.customizable:
        if opt in queryParams:
            val = queryParams[opt]
            if (val.isdigit() or
                (val.startswith('-')
                 and val[1:].isdigit())) and 'color' not in opt.lower():
                val = int(val)
            elif '.' in val and (val.replace('.', '', 1).isdigit() or
                                 (val.startswith('-')
                                  and val[1:].replace('.', '', 1).isdigit())):
                val = float(val)
            elif val.lower() in ('true', 'false'):
                val = val.lower() == 'true'
            elif val.lower() == 'default' or val == '':
                continue
            graphOptions[opt] = val

    tzinfo = pytz.timezone(settings.TIME_ZONE)
    if 'tz' in queryParams:
        try:
            tzinfo = pytz.timezone(queryParams['tz'])
        except pytz.UnknownTimeZoneError:
            pass
    requestOptions['tzinfo'] = tzinfo

    # Get the time interval for time-oriented graph types
    if graphType == 'line' or graphType == 'pie':
        if 'now' in queryParams:
            now = parseATTime(queryParams['now'], tzinfo)
        else:
            now = datetime.now(tzinfo)

        if 'until' in queryParams:
            untilTime = parseATTime(queryParams['until'], tzinfo, now)
        else:
            untilTime = now
        if 'from' in queryParams:
            fromTime = parseATTime(queryParams['from'], tzinfo, now)
        else:
            fromTime = parseATTime('-1d', tzinfo, now)

        startTime = min(fromTime, untilTime)
        endTime = max(fromTime, untilTime)
        assert startTime != endTime, "Invalid empty time range"

        requestOptions['startTime'] = startTime
        requestOptions['endTime'] = endTime
        timeRange = endTime - startTime
        queryTime = timeRange.days * 86400 + timeRange.seconds  # convert the time delta to seconds
        if settings.DEFAULT_CACHE_POLICY and not queryParams.get(
                'cacheTimeout'):
            timeouts = [
                timeout for period, timeout in settings.DEFAULT_CACHE_POLICY
                if period <= queryTime
            ]
            cacheTimeout = max(timeouts or (0, ))
        requestOptions['now'] = now

    if cacheTimeout == 0:
        requestOptions['noCache'] = True
    requestOptions['cacheTimeout'] = cacheTimeout

    return (graphOptions, requestOptions)
コード例 #4
0
def parseOptions(request):
    queryParams = request.REQUEST

    # Start with some defaults
    graphOptions = {'width': 330, 'height': 250}
    requestOptions = {}

    graphType = queryParams.get('graphType', 'line')
    assert graphType in GraphTypes, "Invalid graphType '%s', must be one of %s" % (
        graphType, GraphTypes.keys())
    graphClass = GraphTypes[graphType]

    # Fill in the requestOptions
    requestOptions['graphType'] = graphType
    requestOptions['graphClass'] = graphClass
    requestOptions['pieMode'] = queryParams.get('pieMode', 'average')
    requestOptions['cacheTimeout'] = int(
        queryParams.get('cacheTimeout', settings.DEFAULT_CACHE_DURATION))
    requestOptions['targets'] = []
    for target in queryParams.getlist('target'):
        requestOptions['targets'].append(target)

    if 'pickle' in queryParams:
        requestOptions['pickle'] = True
    if 'rawData' in queryParams:
        requestOptions['format'] = 'raw'
    if 'format' in queryParams:
        requestOptions['format'] = queryParams['format']
        if 'jsonp' in queryParams:
            requestOptions['jsonp'] = queryParams['jsonp']
    if 'noCache' in queryParams:
        requestOptions['noCache'] = True

    requestOptions['localOnly'] = queryParams.get('local') == '1'

    # Fill in the graphOptions
    for opt in graphClass.customizable:
        if opt in queryParams:
            val = queryParams[opt]
            if (val.isdigit() or
                (val.startswith('-') and val[1:].isdigit())) and opt not in (
                    'fgcolor', 'bgcolor', 'fontColor'):
                val = int(val)
            elif '.' in val and (val.replace('.', '', 1).isdigit() or
                                 (val.startswith('-')
                                  and val[1:].replace('.', '', 1).isdigit())):
                val = float(val)
            elif val.lower() in ('true', 'false'):
                val = val.lower() == 'true'
            elif val.lower() == 'default' or val == '':
                continue
            graphOptions[opt] = val

    # Get the time interval for time-oriented graph types
    if graphType == 'line' or graphType == 'pie':
        if 'until' in queryParams:
            untilTime = parseATTime(queryParams['until'])
        else:
            untilTime = datetime.now()
        if 'from' in queryParams:
            fromTime = parseATTime(queryParams['from'])
        else:
            fromTime = untilTime - timedelta(days=1)

        startTime = min(fromTime, untilTime)
        endTime = max(fromTime, untilTime)
        assert startTime != endTime, "Invalid empty time range"

        requestOptions['startTime'] = startTime
        requestOptions['endTime'] = endTime

    return (graphOptions, requestOptions)
コード例 #5
0
ファイル: views.py プロジェクト: dkulikovsky/graphite-ch-web
def parseOptionsDictionary(queryParams):
    # Start with some defaults
    graphOptions = {'width': 330, 'height': 250}
    requestOptions = {}

    graphType = queryParams.get('graphType', 'line')
    assert graphType in GraphTypes, "Invalid graphType '%s', must be one of %s" % (
        graphType, GraphTypes.keys())
    graphClass = GraphTypes[graphType]

    # Fill in the requestOptions
    requestOptions['graphType'] = graphType
    requestOptions['graphClass'] = graphClass
    requestOptions['pieMode'] = queryParams.get('pieMode', 'average')
    requestOptions['cacheTimeout'] = int(
        queryParams.get('cacheTimeout', settings.DEFAULT_CACHE_DURATION))
    requestOptions['targets'] = []

    # Extract the targets out of the queryParams
    mytargets = []
    # json_request format
    if len(queryParams.getlist('targets')) > 0:
        mytargets = queryParams.getlist('targets')

    # Normal format: ?target=path.1&target=path.2
    if len(queryParams.getlist('target')) > 0:
        mytargets = queryParams.getlist('target')

    # Rails/PHP/jQuery common practice format: ?target[]=path.1&target[]=path.2
    elif len(queryParams.getlist('target[]')) > 0:
        mytargets = queryParams.getlist('target[]')

    # Collect the targets
    for target in mytargets:
        requestOptions['targets'].append(target)

    if 'pickle' in queryParams:
        requestOptions['format'] = 'pickle'
    if 'rawData' in queryParams:
        requestOptions['format'] = 'raw'
    if 'format' in queryParams:
        requestOptions['format'] = queryParams['format']
        if 'jsonp' in queryParams:
            requestOptions['jsonp'] = queryParams['jsonp']
    if 'noCache' in queryParams:
        requestOptions['noCache'] = True
    if 'maxDataPoints' in queryParams and queryParams['maxDataPoints'].isdigit(
    ):
        requestOptions['maxDataPoints'] = int(queryParams['maxDataPoints'])

    requestOptions['localOnly'] = queryParams.get('local') == '1'

    # Fill in the graphOptions
    for opt in graphClass.customizable:
        if opt in queryParams:
            val = unicode(queryParams[opt])
            if (val.isdigit() or
                (val.startswith('-')
                 and val[1:].isdigit())) and 'color' not in opt.lower():
                val = int(val)
            elif '.' in val and (val.replace('.', '', 1).isdigit() or
                                 (val.startswith('-')
                                  and val[1:].replace('.', '', 1).isdigit())):
                val = float(val)
            elif val.lower() in ('true', 'false'):
                val = val.lower() == 'true'
            elif val.lower() == 'default' or val == '':
                continue
            graphOptions[opt] = val

    tzinfo = pytz.timezone(settings.TIME_ZONE)
    if 'tz' in queryParams:
        try:
            tzinfo = pytz.timezone(queryParams['tz'])
        except pytz.UnknownTimeZoneError:
            pass
    requestOptions['tzinfo'] = tzinfo

    # Get the time interval for time-oriented graph types
    if graphType == 'line' or graphType == 'pie':
        if 'until' in queryParams:
            untilTime = parseATTime(queryParams['until'], tzinfo)
        else:
            untilTime = parseATTime('now', tzinfo)
        if 'from' in queryParams:
            fromTime = parseATTime(queryParams['from'], tzinfo)
        else:
            fromTime = parseATTime('-1d', tzinfo)

        startTime = min(fromTime, untilTime)
        endTime = max(fromTime, untilTime)
        assert startTime != endTime, "Invalid empty time range"

        requestOptions['startTime'] = startTime
        requestOptions['endTime'] = endTime

    return (graphOptions, requestOptions)
コード例 #6
0
ファイル: views.py プロジェクト: jbrownbridge/graphite-render
def parseOptions(request):
  queryParams = request.REQUEST

  # Start with some defaults
  graphOptions = {'width' : 330, 'height' : 250}
  requestOptions = {}

  graphType = queryParams.get('graphType','line')
  assert graphType in GraphTypes, "Invalid graphType '%s', must be one of %s" % (graphType,GraphTypes.keys())
  graphClass = GraphTypes[graphType]

  # Fill in the requestOptions
  requestOptions['graphType'] = graphType
  requestOptions['graphClass'] = graphClass
  requestOptions['pieMode'] = queryParams.get('pieMode', 'average')
  requestOptions['targets'] = []
  for target in queryParams.getlist('target'):
    if target.lower().startswith('graphite.'): #Strip leading "Graphite." as a convenience
      target = target[9:]
    requestOptions['targets'].append(target)

  requestOptions['timers'] = []
  for stat in queryParams.getlist('timer'):
    requestOptions['timers'].append(stat)

  if 'pickle' in queryParams:
    requestOptions['pickle'] = True
  if 'rawData' in queryParams:
    requestOptions['rawData'] = True
  if 'noCache' in queryParams:
    requestOptions['noCache'] = True

  # Fill in the graphOptions
  for opt in graphClass.customizable:
    if opt in queryParams:
      val = queryParams[opt]
      if (val.isdigit() or (val.startswith('-') and val[1:].isdigit())) and opt not in ('fgcolor','bgcolor','fontColor'):
        val = int(val)
      elif '.' in val and (val.replace('.','',1).isdigit() or (val.startswith('-') and val[1:].replace('.','',1).isdigit())):
        val = float(val)
      elif val.lower() in ('true','false'):
        val = eval( val.lower().capitalize() )
      elif val.lower() == 'default' or val == '':
        continue
      graphOptions[opt] = val

  # Get the time interval for time-oriented graph types
  if graphType == 'line' or graphType == 'pie':
    if 'until' in queryParams:
      endTime = parseATTime( queryParams['until'] )
    else:
      endTime = datetime.now()
    if 'from' in queryParams:
      startTime = parseATTime( queryParams['from'] )
    else:
      startTime = endTime - timedelta(days=1)
    if endTime > datetime.now():
      endTime = datetime.now()
    assert startTime < endTime, "Invalid time range!"
    
    requestOptions['startTime'] = startTime
    requestOptions['endTime'] = endTime

  return (graphOptions, requestOptions)
コード例 #7
0
def parseOptions(request):
    queryParams = request.REQUEST

    # Start with some defaults
    graphOptions = {'width': 330, 'height': 250}
    requestOptions = {}

    graphType = queryParams.get('graphType', 'line')
    assert graphType in GraphTypes, "Invalid graphType '%s', must be one of %s" % (
        graphType, GraphTypes.keys())
    graphClass = GraphTypes[graphType]

    # Fill in the requestOptions
    requestOptions['graphType'] = graphType
    requestOptions['graphClass'] = graphClass
    requestOptions['pieMode'] = queryParams.get('pieMode', 'average')
    requestOptions['targets'] = []
    for target in queryParams.getlist('target'):
        if target.lower().startswith(
                'graphite.'):  #Strip leading "Graphite." as a convenience
            target = target[9:]
        requestOptions['targets'].append(target)

    requestOptions['timers'] = []
    for stat in queryParams.getlist('timer'):
        requestOptions['timers'].append(stat)

    if 'pickle' in queryParams:
        requestOptions['pickle'] = True
    if 'rawData' in queryParams:
        requestOptions['rawData'] = True
    if 'noCache' in queryParams:
        requestOptions['noCache'] = True

    # Fill in the graphOptions
    for opt in graphClass.customizable:
        if opt in queryParams:
            val = queryParams[opt]
            if (val.isdigit() or
                (val.startswith('-') and val[1:].isdigit())) and opt not in (
                    'fgcolor', 'bgcolor', 'fontColor'):
                val = int(val)
            elif '.' in val and (val.replace('.', '', 1).isdigit() or
                                 (val.startswith('-')
                                  and val[1:].replace('.', '', 1).isdigit())):
                val = float(val)
            elif val.lower() in ('true', 'false'):
                val = eval(val.lower().capitalize())
            elif val.lower() == 'default' or val == '':
                continue
            graphOptions[opt] = val

    # Get the time interval for time-oriented graph types
    if graphType == 'line' or graphType == 'pie':
        if 'until' in queryParams:
            endTime = parseATTime(queryParams['until'])
        else:
            endTime = datetime.now()
        if 'from' in queryParams:
            startTime = parseATTime(queryParams['from'])
        else:
            startTime = endTime - timedelta(days=1)
        if endTime > datetime.now():
            endTime = datetime.now()
        assert startTime < endTime, "Invalid time range!"

        requestOptions['startTime'] = startTime
        requestOptions['endTime'] = endTime

    return (graphOptions, requestOptions)
コード例 #8
0
ファイル: views.py プロジェクト: 3ofcoins/graphite_stack
def parseOptions(request):
  queryParams = request.REQUEST

  # Start with some defaults
  graphOptions = {'width' : 330, 'height' : 250}
  requestOptions = {}

  graphType = queryParams.get('graphType','line')
  assert graphType in GraphTypes, "Invalid graphType '%s', must be one of %s" % (graphType,GraphTypes.keys())
  graphClass = GraphTypes[graphType]

  # Fill in the requestOptions
  requestOptions['graphType'] = graphType
  requestOptions['graphClass'] = graphClass
  requestOptions['pieMode'] = queryParams.get('pieMode', 'average')
  requestOptions['cacheTimeout'] = int( queryParams.get('cacheTimeout', settings.DEFAULT_CACHE_DURATION) )
  requestOptions['targets'] = []
  for target in queryParams.getlist('target'):
    requestOptions['targets'].append(target)

  if 'pickle' in queryParams:
    requestOptions['format'] = 'pickle'
  if 'rawData' in queryParams:
    requestOptions['format'] = 'raw'
  if 'format' in queryParams:
    requestOptions['format'] = queryParams['format']
    if 'jsonp' in queryParams:
      requestOptions['jsonp'] = queryParams['jsonp']
  if 'noCache' in queryParams:
    requestOptions['noCache'] = True

  requestOptions['localOnly'] = queryParams.get('local') == '1'

  # Fill in the graphOptions
  for opt in graphClass.customizable:
    if opt in queryParams:
      val = queryParams[opt]
      if (val.isdigit() or (val.startswith('-') and val[1:].isdigit())) and opt not in ('fgcolor','bgcolor','fontColor'):
        val = int(val)
      elif '.' in val and (val.replace('.','',1).isdigit() or (val.startswith('-') and val[1:].replace('.','',1).isdigit())):
        val = float(val)
      elif val.lower() in ('true','false'):
        val = val.lower() == 'true'
      elif val.lower() == 'default' or val == '':
        continue
      graphOptions[opt] = val

  # Get the time interval for time-oriented graph types
  if graphType == 'line' or graphType == 'pie':
    if 'until' in queryParams:
      untilTime = parseATTime( queryParams['until'] )
    else:
      untilTime = parseATTime('now')
    if 'from' in queryParams:
      fromTime = parseATTime( queryParams['from'] )
    else:
      fromTime = parseATTime('-1d')

    startTime = min(fromTime, untilTime)
    endTime = max(fromTime, untilTime)
    assert startTime != endTime, "Invalid empty time range"
    
    requestOptions['startTime'] = startTime
    requestOptions['endTime'] = endTime

  return (graphOptions, requestOptions)