repoze.bfg.wsgi

repoze.bfg.wsgi.wsgiapp(wrapped)

Decorator to turn a WSGI application into a repoze.bfg view callable. This decorator differs from the wsgiapp2 decorator inasmuch as fixups of PATH_INFO and SCRIPT_NAME within the WSGI environment are not performed before the application is invoked.

E.g.:

@wsgiapp
def hello_world(environ, start_response):
    body = 'Hello world'
    start_response('200 OK', [ ('Content-Type', 'text/plain'),
                               ('Content-Length', len(body)) ] )
    return [body]

Allows the following view declaration to be made:

<view
   view=".views.hello_world"
   name="hello_world.txt"
   context="*"
 />

The wsgiapp decorator will convert the result of the WSGI application to a Response and return it to repoze.bfg as if the WSGI app were a repoze.bfg view.

repoze.bfg.wsgi.wsgiapp2(wrapped)

Decorator to turn a WSGI application into a repoze.bfg view callable. This decorator differs from the wsgiapp decorator inasmuch as fixups of PATH_INFO and SCRIPT_NAME within the WSGI environment are performed before the application is invoked.

E.g.:

@wsgiapp2
def hello_world(environ, start_response):
    body = 'Hello world'
    start_response('200 OK', [ ('Content-Type', 'text/plain'),
                               ('Content-Length', len(body)) ] )
    return [body]

Allows the following view declaration to be made:

<view
   view=".views.hello_world"
   name="hello_world.txt"
   context="*"
 />

The wsgiapp2 decorator will convert the result of the WSGI application to a Response and return it to repoze.bfg as if the WSGI app were a repoze.bfg view. The SCRIPT_NAME and PATH_INFO values present in the WSGI environment are fixed up before the application is invoked.

Previous topic

repoze.bfg.view

Next topic

ZODB + Traversal Wiki Tutorial

This Page

Quick search