ERRATA: Fixed a problem in trunk and here is a better example:

# sample test app
def test_wsgi_app(environ, start_response):
    """just a test app"""
    status = '200 OK'
    response_headers = [('Content-type','text/plain'),('Content-
Length','13')]
    start_response(status, response_headers)
    return ['hello world!\n']

# sample controller action calling the wsgi app above
def index():
    items = test_wsgi_app
(request.wsgi.environ,request.wsgi.start_response)
    for item in items: response.write(item,escape=False)
    return response.body.getvalue()


On Oct 29, 10:44 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
> This got buried in a previous thread but it is important. In trunk we
> have and experimental feature:
>
> request.wsgi.environ and request.wsgi.start_response
>
> this means that you can now call ANY wsgi function from inside a
> web2py action:
>
> def index():
>     some_wsgi_app(request.wsgi.environ,request.wsgi.start_response)
>     request.wsgi.start_response(200)
>     return response.body.getvalue()
>
> Now you can run a Django app in one controller and a CherryPy app in
> another + the wsgi apps can access web2py sessions, auth decorators,
> etc.
>
> It is perverse but can be useful. If you test it please let me know if
> it works for you.
>
> Massimo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to