def api_new_app(): try: file = request.files['file'] app = App.from_file(file) except Exception as e: web.logger.error('%r', e) res = jsonify({'message': e.message}) res.status_code = 400 return res else: db.session.add(app) db.session.commit() return jsonify(simple_serialize(app))
def serializer(instance, *args, **kw): result = simple_serialize(instance) result['attributes']['foo'] = temp.pop() return result
def add_bar(instance, *args, **kw): result = simple_serialize(instance, *args, **kw) if 'attributes' not in result: result['attributes'] = {} result['attributes']['bar'] = 'bar' return result
def serializer(instance, **kw): result = simple_serialize(instance, **kw) result['attributes']['foo'] = 'bar' return result