Ejemplo n.º 1
0
    app information.
    '''
    params = web.input(data=None)
    try:
      if params.data:
        data = decode_json(params.data)
      else:
        data = decode_json(web.ctx.data)
      App.validate(data)
    except Exception, e:
      logging.error(e)
      return error_response(400, 'Data did not pass validation')

    try:
      app = App(data)
      app.set_creator(auth_user)
      app.save()
      formatted_dict = app.formatted_dict()
      return encode_json(formatted_dict)
    except Exception, e:
      logging.error(e)
      return error_response(500)


class AppHandler(object):
  '''
  Handler for retrieving information about a specific app. Also
  allows app information to be updated, or for an app to be deleted. Only
  the creator can access and modify the app information.
  '''
Ejemplo n.º 2
0
    app information.
    '''
        params = web.input(data=None)
        try:
            if params.data:
                data = decode_json(params.data)
            else:
                data = decode_json(web.ctx.data)
            App.validate(data)
        except Exception, e:
            logging.error(e)
            return error_response(400, 'Data did not pass validation')

        try:
            app = App(data)
            app.set_creator(auth_user)
            app.save()
            formatted_dict = app.formatted_dict()
            return encode_json(formatted_dict)
        except Exception, e:
            logging.error(e)
            return error_response(500)


class AppHandler(object):
    '''
  Handler for retrieving information about a specific app. Also
  allows app information to be updated, or for an app to be deleted. Only
  the creator can access and modify the app information.
  '''
    @public_api_auth