def getCustomer(): error = False id = request.json['id'] new = Customer() new.id = id try: new.get() except (Exception) as err: error = True return handleError(err) finally: if not (error): result = new.json() return jsonify({'result': 'success', 'data': result})
def getUserInfo(): error = False result = {} id = request.json['id'] user = User() user.id = id try: user.get() result['user'] = user.json() cust = Customer() cust.id_user = id cust.getUser() if (cust.id != None): result['customer'] = cust.json() except (Exception) as err: error = True return handleError(err) finally: if not (error): return jsonify({'result': 'success', 'data': result})