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

Changeset 523

Show
Ignore:
Timestamp:
08/09/05 17:15:36
Author:
fumanchu
Message:

Request-URI of "*" can now be served by an exposed "cherrypy.root._global" method.

Files:

Legend:

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

    r522 r523  
    733733    else: 
    734734        objectPathList = tpath.split('/') 
     735    if objectPathList == ['global']: 
     736        objectPathList = ['_global'] 
    735737    objectPathList = ['root'] + objectPathList + ['index'] 
    736738     
  • trunk/cherrypy/_cpwsgi.py

    r498 r523  
    4141     
    4242    resource = environ.get('SCRIPT_NAME', '') + environ.get('PATH_INFO', '') 
    43     if not resource.startswith("/"): 
     43    if not (resource == "*" or resource.startswith("/")): 
    4444        resource = "/" + resource 
    4545    qString = environ.get('QUERY_STRING') 
  • trunk/cherrypy/_cpwsgiserver.py

    r484 r523  
    7878            qs = "" 
    7979        self.environ["REQUEST_METHOD"] = method 
    80         self.environ["SCRIPT_NAME"] = path[1:] 
     80        if path == "*": 
     81            self.environ["SCRIPT_NAME"] = path 
     82        else: 
     83            self.environ["SCRIPT_NAME"] = path[1:] 
    8184        self.environ["PATH_INFO"] = "" 
    8285        self.environ["QUERY_STRING"] = qs 
  • trunk/cherrypy/test/test_core.py

    r522 r523  
    3333 
    3434class Root: 
     35     
    3536    def index(self): 
    3637        return "hello" 
    3738    index.exposed = True 
     39     
     40    def _global(self): 
     41        pass 
     42    _global.exposed = True 
    3843 
    3944cherrypy.root = Root() 
     
    245250     
    246251    def testConfig(self): 
    247         self.assertEqual(cherrypy.config.configMap["global"]["luxuryyacht"], 
    248                          'throatwobblermangrove') 
    249          
    250252        tests = [ 
     253            ('global',   'luxuryyacht', 'throatwobblermangrove'), 
    251254            ('/',        'nex', None   ), 
    252255            ('/',        'foo', 'this' ), 
     
    429432        self.getPage("/method/", method="SEARCH") 
    430433        self.assertStatus("501 Not Implemented") 
     434         
     435        # Request the OPTIONS method with a Request-URI of "*". 
     436        self.getPage("*", method="OPTIONS") 
     437        self.assertStatus("200 OK") 
     438        # Content-Length header required for OPTIONS with no response body. 
     439        # See http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.2 
     440        self.assertHeader("Content-Length", "0") 
    431441     
    432442    def testFavicon(self): 

Hosted by WebFaction

Log in as guest/cpguest to create tickets