Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1867

Show
Ignore:
Timestamp:
01/17/08 00:24:53
Author:
fumanchu
Message:

Fix for #772 (Make the wsgiserver single-app by default).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/_cpwsgi.py

    r1786 r1867  
    364364         
    365365        s = wsgiserver.CherryPyWSGIServer 
    366         # We could just pass cherrypy.tree, but by passing tree.apps, 
    367         # we get correct SCRIPT_NAMEs as early as possible. 
    368         s.__init__(self, bind_addr, _cherrypy.tree.apps, 
     366        s.__init__(self, bind_addr, _cherrypy.tree, 
    369367                   server.thread_pool, 
    370368                   server.socket_host, 
  • trunk/cherrypy/test/helper.py

    r1837 r1867  
    124124 
    125125def sync_apps(profile=False, validate=False, conquer=False): 
    126     apps = [] 
    127     for base, app in cherrypy.tree.apps.iteritems(): 
    128         if base == "/": 
    129             base = "" 
    130         if profile: 
    131             app = profiler.make_app(app, aggregate=False) 
    132         if conquer: 
    133             try: 
    134                 import wsgiconq 
    135             except ImportError: 
    136                 warnings.warn("Error importing wsgiconq. pyconquer will not run.") 
    137             else: 
    138                 app = wsgiconq.WSGILogger(app) 
    139         if validate: 
    140             try: 
    141                 from wsgiref import validate 
    142             except ImportError: 
    143                 warnings.warn("Error importing wsgiref. The validator will not run.") 
    144             else: 
    145                 app = validate.validator(app) 
    146         apps.append((base, app)) 
    147     apps.sort() 
    148     apps.reverse() 
    149     cherrypy.server.httpserver.wsgi_app.apps = apps 
     126    app = cherrypy.tree 
     127    if profile: 
     128        app = profiler.make_app(app, aggregate=False) 
     129    if conquer: 
     130        try: 
     131            import wsgiconq 
     132        except ImportError: 
     133            warnings.warn("Error importing wsgiconq. pyconquer will not run.") 
     134        else: 
     135            app = wsgiconq.WSGILogger(app) 
     136    if validate: 
     137        try: 
     138            from wsgiref import validate 
     139        except ImportError: 
     140            warnings.warn("Error importing wsgiref. The validator will not run.") 
     141        else: 
     142            app = validate.validator(app) 
     143    cherrypy.server.httpserver.wsgi_app = app 
    150144 
    151145def _run_test_suite_thread(moduleNames, conf): 
  • trunk/cherrypy/wsgiserver/__init__.py

    r1850 r1867  
    1717     
    1818The CherryPy WSGI server can serve as many WSGI applications  
    19 as you want in one instance
    20      
    21     wsgi_apps = [('/', my_crazy_app), ('/blog', my_blog_app)] 
    22     server = wsgiserver.CherryPyWSGIServer(('0.0.0.0', 80), wsgi_apps
     19as you want in one instance by using a WSGIPathInfoDispatcher
     20     
     21    d = WSGIPathInfoDispatcher({'/': my_crazy_app, '/blog': my_blog_app}) 
     22    server = wsgiserver.CherryPyWSGIServer(('0.0.0.0', 80), d
    2323     
    2424Want SSL support? Just set these attributes: 
     
    3636WSGI server, which is independant from the rest of CherryPy. Don't 
    3737let the name "CherryPyWSGIServer" throw you; the name merely reflects 
    38 its origin, not it's coupling. 
     38its origin, not its coupling. 
    3939""" 
    4040 
     
    5757from urllib import unquote 
    5858from urlparse import urlparse 
     59import warnings 
    5960 
    6061try: 
     
    10151016            # so that the server can call different wsgi_apps, and also 
    10161017            # correctly set SCRIPT_NAME. 
     1018            warnings.warn("The ability to pass multiple apps is deprecated " 
     1019                          "and will be removed in 3.2. You should explicitly " 
     1020                          "include a WSGIPathInfoDispatcher instead.", 
     1021                          DeprecationWarning) 
    10171022            self.wsgi_app = WSGIPathInfoDispatcher(wsgi_app) 
    10181023         

Hosted by WebFaction

Log in as guest/cpguest to create tickets