pngtile/wsgi.py
author Tero Marttila <terom@fixme.fi>
Mon, 25 Jan 2010 19:45:50 +0200
changeset 93 581cdb831b32
parent 92 e50ec4217fe6
child 103 1a6a6957197d
permissions -rw-r--r--
split off werkzeug code to separate handlers module..
30
53e99e552122 move the python/web code in
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     1
"""
53e99e552122 move the python/web code in
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     2
    Our WSGI web interface, which can serve the JS UI and any .png tiles via HTTP.
53e99e552122 move the python/web code in
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     3
"""
53e99e552122 move the python/web code in
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     4
93
581cdb831b32 split off werkzeug code to separate handlers module..
Tero Marttila <terom@fixme.fi>
parents: 92
diff changeset
     5
from werkzeug import Request, responder
30
53e99e552122 move the python/web code in
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
     6
from werkzeug import exceptions
92
e50ec4217fe6 separate non-wsgi render layer to render.png
Tero Marttila <terom@fixme.fi>
parents: 90
diff changeset
     7
93
581cdb831b32 split off werkzeug code to separate handlers module..
Tero Marttila <terom@fixme.fi>
parents: 92
diff changeset
     8
from pngtile import handlers
89
02e5b9b08881 rework wsgi.py
Tero Marttila <terom@fixme.fi>
parents: 47
diff changeset
     9
30
53e99e552122 move the python/web code in
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    10
53e99e552122 move the python/web code in
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    11
@responder
53e99e552122 move the python/web code in
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    12
def application (env, start_response) :
89
02e5b9b08881 rework wsgi.py
Tero Marttila <terom@fixme.fi>
parents: 47
diff changeset
    13
    """
93
581cdb831b32 split off werkzeug code to separate handlers module..
Tero Marttila <terom@fixme.fi>
parents: 92
diff changeset
    14
        Main WSGI entry point.
581cdb831b32 split off werkzeug code to separate handlers module..
Tero Marttila <terom@fixme.fi>
parents: 92
diff changeset
    15
581cdb831b32 split off werkzeug code to separate handlers module..
Tero Marttila <terom@fixme.fi>
parents: 92
diff changeset
    16
        This is wrapped with werkzeug, so we can return a Response object
89
02e5b9b08881 rework wsgi.py
Tero Marttila <terom@fixme.fi>
parents: 47
diff changeset
    17
    """
02e5b9b08881 rework wsgi.py
Tero Marttila <terom@fixme.fi>
parents: 47
diff changeset
    18
30
53e99e552122 move the python/web code in
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    19
    req = Request(env, start_response)
53e99e552122 move the python/web code in
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    20
    
53e99e552122 move the python/web code in
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    21
    try :
93
581cdb831b32 split off werkzeug code to separate handlers module..
Tero Marttila <terom@fixme.fi>
parents: 92
diff changeset
    22
        return handlers.handle_req(req)
30
53e99e552122 move the python/web code in
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    23
53e99e552122 move the python/web code in
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    24
    except exceptions.HTTPException, e :
53e99e552122 move the python/web code in
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    25
        return e
53e99e552122 move the python/web code in
Tero Marttila <terom@fixme.fi>
parents:
diff changeset
    26