def search_food_request_handler(oreq): oresp = PBOneResponse() try: pbrealreq = oreq.searchfoodreq processor = SearchFoodProcessor(pbrealreq) oresp.etype = ERROR_NONE oresp.rtype = SEARCH_FOOD_RESPONSE # a partir de la si il y a une erreur elle est fonctionnelle processor.process(oresp.searchfoodresp) except Exception: traceback.print_exc() oresp = error_response(ERROR_REQUEST_HANDLER) finally: return oresp
def another_request_handler(oreq): oresp = PBOneResponse() try: pbrealreq = oreq.anotherreq processor = AnotherProcessor(pbrealreq) oresp.rtype = ANOTHER_RESPONSE processor.process(oresp.anotherresp) # a partir de la si il y a une erreur elle est fonctionnelle oresp.etype = ERROR_NONE except Exception: print "another_request: ", Exception traceback.print_exc() oresp = error_response(ERROR_REQUEST_HANDLER) finally: return oresp
def simple_request_handler(oreq): oresp = PBOneResponse() try: pbsimplereq = oreq.simplereq processor = SimpleProcessor(pbsimplereq) oresp.rtype = SIMPLE_RESPONSE processor.process(oresp.simpleresp) # a partir de la si il y a une erreur elle est fonctionnelle oresp.etype = ERROR_NONE except Exception: print "simple_request: ", Exception traceback.print_exc() oresp = error_response(ERROR_REQUEST_HANDLER) finally: return oresp