Exemple #1
0
    def process_message(self, application, message):
        request = Request.parse_msg(message)
        if request.is_disconnect():
            return
        handler = application.route_message(request)
        response = handler()

        application.msg_conn.reply(request, json.dumps(response))
    def process_message(self, application, environ, callback):
        request = Request.parse_wsgi_request(environ)
        handler = application.route_message(request)
        result = handler()

        wsgi_status = ' '.join([str(result['status_code']), result['status_msg']])
        headers = [(k, v) for k,v in result['headers'].items()]
        print [to_bytes(result['body'])]
        #print inspect.getargspec(callback)
        print wsgi_status, headers
        callback(str(wsgi_status), headers)
        #from werkzeug.wrappers import Response
        #print result
        #return Response(response=result['body'], status=str(wsgi_status), headers=headers, mimetype=None, content_type='text/plain', direct_passthrough=False)
        #return Response(''.join([to_unicode(result['body'])]))
        return [to_bytes(result['body'])]
Exemple #3
0
def receive_wsgi_req(environ, start_response):
    request = Request.parse_wsgi_request(environ)
    coro_spawn(route_message, self, request)
Exemple #4
0
def receive_wsgi_req(environ, start_response):
    request = Request.parse_wsgi_request(environ)
    coro_spawn(route_message, self, request)