main/util.py
def param(name, cast=None):
  """
  Gets a parameter from the request by name and casts by the desired type
  """
  value = None
  if flask.request.json:
    return flask.request.json.get(name, None)

  if value is None:
    value = flask.request.args.get(name, None)
  if value is None and flask.request.form:
    value = flask.request.form.get(name, None)

  if cast and value is not None:
    if cast is bool:
      return value.lower() in ['true', 'yes', 'y', '1', '']
    if cast is list:
      return value.split(',') if len(value) > 0 else []
    if cast is ndb.Key:
      return ndb.Key(urlsafe=value)
    return cast(value)
  return value

  Gets a parameter from the request by name and casts by the desired type
  
Gets a parameter from the request by name and casts by the desired type
Gets a parameter from the request by name and casts by the desired type
def param(name, cast=None):
  value = None
  if flask.request.json:
    return flask.request.json.get(name, None)
  if value is None:
    value = flask.request.args.get(name, None)
  if value is None and flask.request.form:
    value = flask.request.form.get(name, None)
  if cast and value is not None:
    if cast is bool:
      return value.lower() in ['true', 'yes', 'y', '1', '']
    if cast is list:
      return value.split(',') if len(value) > 0 else []
    if cast is ndb.Key:
      return ndb.Key(urlsafe=value)
    return cast(value)
  return value
def param ( name , cast = None ) : value = None if flask . request . json : return flask . request . json . get ( name , None ) if value is None : value = flask . request . args . get ( name , None ) if value is None and flask . request . form : value = flask . request . form . get ( name , None ) if cast and value is not None : if cast is bool : return value . lower ( ) in [ 'true' , 'yes' , 'y' , '1' , '' ] if cast is list : return value . split ( ',' ) if len ( value ) > 0 else [ ] if cast is ndb . Key : return ndb . Key ( urlsafe = value ) return cast ( value ) return value
Gets a parameter from the request by name and casts by the desired type
Gets a parameter from the request by name and casts by the desired type
"""
  Gets a parameter from the request by name and casts by the desired type
  """
name
cast