Changeset 755
- Timestamp:
- 10/27/05 18:06:41
- Files:
-
- trunk/cherrypy/_cphttptools.py (modified) (1 diff)
- trunk/cherrypy/test/test_core.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/_cphttptools.py
r737 r755 753 753 # a redirect) 754 754 if path[-1] != '/': 755 newUrl = path + '/' 756 if cherrypy.request.queryString: 757 newUrl += "?" + cherrypy.request.queryString 755 atoms = cherrypy.request.browserUrl.split("?", 1) 756 newUrl = atoms.pop(0) + '/' 757 if atoms: 758 newUrl += "?" + atoms[0] 758 759 if getattr(cherrypy, "debug", None): 759 760 cherrypy.log(" Found: redirecting to %s" % newUrl, "DEBUG") trunk/cherrypy/test/test_core.py
r754 r755 38 38 class Root: 39 39 40 _cpFilterList = [] 41 40 42 def index(self): 41 43 return "hello" … … 50 52 51 53 class TestType(type): 52 """Metaclass which automatically exposes all functions in each subclass.""" 54 """Metaclass which automatically exposes all functions in each subclass, 55 and adds an instance of the subclass as an attribute of cherrypy.root. 56 """ 53 57 def __init__(cls, name, bases, dct): 54 58 type.__init__(name, bases, dct) … … 134 138 else: 135 139 raise cherrypy.InternalRedirect('/image/getImagesByUser') 140 141 142 class Slash(Test): 143 def index(self): 144 return "slashed!" 145 146 class VPrefix: 147 def __init__(self, prefix): 148 self.prefix = prefix 149 def onStartResource(self): 150 path = cherrypy.request.path 151 if path.startswith(self.prefix): 152 cherrypy.request.objectPath = path[len(self.prefix):] 153 cherrypy.root._cpFilterList.append(VPrefix("/vpath")) 136 154 137 155 … … 547 565 self.assertStatus('303 See Other') 548 566 self.assertInBody('/errpage') 567 568 # Trailing slash redirect on a virtualpath child. 569 self.getPage("/vpath/slash") 570 self.assertStatus('303 See Other') 571 self.assertInBody('/vpath/slash/') 549 572 550 573 def testCPFilterList(self):

