def orders_put(request): dbsession = DBSession() order = Order() order.entity_id = clean_param_value(request, 'entity_id') order.user_id = clean_param_value(request, 'user_id') order.quantity = clean_param_value(request, 'quantity') order.minPrice = clean_param_value(request, 'minPrice') order.maxPrice = clean_param_value(request, 'maxPrice') order.buyOrSell = clean_param_value(request, 'buyOrSell') order.active = 1 order.timestamp = get_timestamp() hash = hashlib.md5(order.entity_id + order.user_id + str(order.timestamp)).hexdigest() order.hash = hash dbsession.add(order) transaction.commit() order = dbsession.query(Order).filter(Order.hash == hash).one() order_json = convert.decodeOrder(request, dbsession, order) return {'status': 'success', 'order': order_json}
def order_get(request): dbsession = DBSession() id = clean_matchdict_value(request, 'order') order = dbsession.query(Order).filter(Order.id == id).one() order_json = convert.decodeOrder(request, dbsession, order) return {'status': 'success', 'order': order_json}