Changeset 5145
- Timestamp:
- 08/13/08 17:48:30 (3 months ago)
- Files:
-
- branches/1.0/turbogears/controllers.py (modified) (6 diffs)
- branches/1.0/turbogears/qstemplates/quickstart/+package+/templates/login.kid (modified) (2 diffs)
- branches/1.0/turbogears/startup.py (modified) (10 diffs)
- branches/1.0/turbogears/tests/test_controllers.py (modified) (3 diffs)
- branches/1.1/turbogears/controllers.py (modified) (6 diffs)
- branches/1.1/turbogears/qstemplates/quickstart/+package+/templates/login.html (modified) (2 diffs)
- branches/1.1/turbogears/startup.py (modified) (9 diffs)
- branches/1.1/turbogears/tests/test_controllers.py (modified) (4 diffs)
- branches/1.5/turbogears/controllers.py (modified) (1 diff)
- branches/1.5/turbogears/qstemplates/quickstart/+package+/templates/login.html (modified) (2 diffs)
- branches/1.5/turbogears/tests/test_controllers.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.0/turbogears/controllers.py
r4790 r5145 4 4 import re 5 5 import urllib 6 import urlparse 6 7 import types 7 8 from itertools import izip … … 502 503 503 504 tgpath can be a list or a string. If the path is absolute (starts 504 with a "/"), the server.webpath and the approot of the application505 a re prepended to the path. In order for the approot to be506 detected properly, the root object should extend505 with a "/"), the server.webpath, SCRIPT_NAME and the approot of the 506 application are prepended to the path. In order for the approot to 507 be detected properly, the root object should extend 507 508 controllers.RootController. 508 509 … … 515 516 """ 516 517 if not isinstance(tgpath, basestring): 517 tgpath = "/".join(list(tgpath)) 518 if tgpath.startswith("/"): 518 tgpath = '/'.join(list(tgpath)) 519 if tgpath.startswith('/'): 520 webpath = config.get('server.webpath', '').rstrip('/') 519 521 if tg_util.request_available(): 520 522 check_app_root() 521 523 tgpath = request.app_root + tgpath 522 result = config.get("server.webpath", "") + tgpath 523 else: 524 result = tgpath 524 try: 525 webpath += request.wsgi_environ['SCRIPT_NAME'].rstrip('/') 526 except (AttributeError, KeyError): 527 pass 528 tgpath = webpath + tgpath 525 529 if tgparams is None: 526 530 tgparams = kw … … 543 547 continue 544 548 if isinstance(v, unicode): 545 v = v.encode( "utf8")546 args.append( "%s=%s"% (k, urllib.quote(str(v))))549 v = v.encode('utf8') 550 args.append('%s=%s' % (k, urllib.quote(str(v)))) 547 551 if args: 548 result += "?" + "&".join(args)549 return result552 tgpath += '?' + '&'.join(args) 553 return tgpath 550 554 551 555 552 556 def check_app_root(): 553 557 """Sets request.app_root if needed.""" 554 if hasattr(request, "app_root"):558 if hasattr(request, 'app_root'): 555 559 return 556 560 found_root = False … … 572 576 if found_root and i > 0: 573 577 rootlist.insert(0, path) 574 app_root = "/".join(rootlist)575 if not app_root.startswith( "/"):576 app_root = "/"+ app_root577 if app_root.endswith( "/"):578 app_root = '/'.join(rootlist) 579 if not app_root.startswith('/'): 580 app_root = '/' + app_root 581 if app_root.endswith('/'): 578 582 app_root = app_root[:-1] 579 583 request.app_root = app_root … … 587 591 588 592 """ 593 if not redirect_path.startswith('/'): 594 path = request.object_path 595 check_app_root() 596 if path.startswith(request.app_root): 597 path = path[len(request.app_root):] 598 redirect_path = urlparse.urljoin(path, redirect_path) 589 599 raise cherrypy.HTTPRedirect(url(tgpath=redirect_path, 590 600 tgparams=redirect_params, **kw)) branches/1.0/turbogears/qstemplates/quickstart/+package+/templates/login.kid
r3288 r5145 77 77 <h1>Login</h1> 78 78 <p>${message}</p> 79 <form action="${ previous_url}" method="POST">79 <form action="${tg.url(previous_url)}" method="POST"> 80 80 <table> 81 81 <tr> … … 104 104 <input py:if="forward_url" type="hidden" name="forward_url" 105 105 value="${forward_url}"/> 106 106 107 107 <div py:for="name,values in original_parameters.items()" py:strip="1"> 108 108 <input py:for="value in isinstance(values, list) and values or [values]" branches/1.0/turbogears/startup.py
r3617 r5145 11 11 import pkg_resources 12 12 import cherrypy 13 from cherrypy import _cputil 13 from cherrypy import _cputil, request, server 14 14 from formencode.variabledecode import NestedVariables 15 15 from cherrypy._cpwsgi import wsgiApp, CPHTTPRequest … … 79 79 cherrypy.lib.autoreload.reloader_thread = reloader_thread 80 80 81 webpath = ""81 webpath = '' 82 82 83 83 DNS_SD_PID = None … … 88 88 if DNS_SD_PID: 89 89 return 90 if (not hasattr(cherrypy, "root")) or (not cherrypy.root):90 if not hasattr(cherrypy, "root") or not cherrypy.root: 91 91 return 92 92 if not package: … … 128 128 That is, you can mount your app so the URI "/users/~rdel/myapp/" 129 129 maps to the root object "/". 130 130 131 """ 131 132 132 def on_start_resource(self): 133 prefix = config.get('server.webpath', False) 134 if prefix: 135 path = cherrypy.request.object_path 136 if path == prefix: 137 cherrypy.request.object_path = '/' 138 elif path.startswith(prefix): 139 cherrypy.request.object_path = path[len(prefix):] 140 else: 133 def __init__(self, webpath=''): 134 webpath = webpath.rstrip('/') 135 if webpath and not webpath.startswith('/'): 136 webpath = '/' + webpath 137 self.webpath = webpath 138 139 def before_request_body(self): 140 webpath = self.webpath 141 try: 142 webpath += request.wsgi_environ['SCRIPT_NAME'].rstrip('/') 143 except (AttributeError, KeyError): 144 pass 145 if webpath: 146 path = request.object_path 147 if path == webpath: 148 request.object_path = '/' 149 elif path.startswith(webpath): 150 request.object_path = path[len(webpath):] 151 elif not request.path.startswith(webpath): 141 152 raise cherrypy.NotFound(path) 142 153 154 143 155 class NestedVariablesFilter(object): 144 156 145 157 def before_main(self): 146 if hasattr(cherrypy.request, "params"): 147 cherrypy.request.params = \ 148 NestedVariables.to_python(cherrypy.request.params or {}) 158 if hasattr(request, 'params'): 159 request.params = NestedVariables.to_python(request.params or {}) 149 160 150 161 … … 154 165 This adds the "tg_js" configuration to make MochiKit accessible. 155 166 It also turns on stdlib logging when in development mode. 167 156 168 """ 157 169 config.update({"/tg_static": … … 183 195 view.loadBaseTemplates() 184 196 global webpath 185 webpath = config.get( "server.webpath", "")186 187 if hasattr(cherrypy, "root") and cherrypy.root:188 if not hasattr(cherrypy.root, "_cp_filters"):197 webpath = config.get('server.webpath', '') 198 199 if hasattr(cherrypy, 'root') and cherrypy.root: 200 if not hasattr(cherrypy.root, '_cp_filters'): 189 201 cherrypy.root._cp_filters= [] 190 morefilters = [EndTransactionsFilter(), 191 NestedVariablesFilter()] 192 if webpath: 193 morefilters.insert(0, VirtualPathFilter()) 202 morefilters = [EndTransactionsFilter(), NestedVariablesFilter()] 203 morefilters.insert(0, VirtualPathFilter(webpath)) 194 204 cherrypy.root._cp_filters.extend(morefilters) 195 205 196 if webpath.startswith("/"):197 webpath = webpath[1:]198 if webpath and not webpath.endswith("/"):199 webpath = webpath + "/" 206 webpath = webpath.lstrip('/') 207 if webpath and not webpath.endswith('/'): 208 webpath += '/' 209 200 210 isdev = config.get('server.environment') == 'development' 201 211 if not config.get("tg.new_style_logging"): … … 265 275 log.info("Scheduler stopped") 266 276 277 267 278 old_object_trail = _cputil.get_object_trail 268 279 … … 271 282 trail = old_object_trail(object_path) 272 283 try: 273 cherrypy.request.object_trail = trail284 request.object_trail = trail 274 285 except AttributeError: 275 286 pass … … 277 288 278 289 _cputil.get_object_trail = get_object_trail 290 279 291 280 292 class SimpleWSGIServer(CherryPyWSGIServer): … … 293 305 wsgi_app = EvalException(wsgi_app, global_conf={}) 294 306 cherrypy.config.update({'server.throw_errors':True}) 295 bind_addr = (conf( "server.socket_host"), conf("server.socket_port"))307 bind_addr = (conf('server.socket_host'), conf('server.socket_port')) 296 308 CherryPyWSGIServer.__init__(self, bind_addr, wsgi_app, 297 conf("server.thread_pool"), 298 conf("server.socket_host"), 299 request_queue_size = conf( 300 "server.socket_queue_size"), 301 ) 309 conf("server.thread_pool"), conf("server.socket_host"), 310 request_queue_size = conf("server.socket_queue_size")) 311 302 312 303 313 def start_server(root): 304 314 cherrypy.root = root 305 if config.get( "tg.fancy_exception", False):306 cherrypy.server.start(server=SimpleWSGIServer())315 if config.get('tg.fancy_exception', False): 316 server.start(server=SimpleWSGIServer()) 307 317 else: 308 cherrypy.server.start() 309 310 if startTurboGears not in cherrypy.server.on_start_server_list: 311 cherrypy.server.on_start_server_list.append(startTurboGears) 312 313 if stopTurboGears not in cherrypy.server.on_stop_server_list: 314 cherrypy.server.on_stop_server_list.append(stopTurboGears) 318 server.start() 319 320 321 if startTurboGears not in server.on_start_server_list: 322 server.on_start_server_list.append(startTurboGears) 323 324 if stopTurboGears not in server.on_stop_server_list: 325 server.on_stop_server_list.append(stopTurboGears) 315 326 316 327 call_on_startup = [] branches/1.0/turbogears/tests/test_controllers.py
r4790 r5145 617 617 def test_approots(self): 618 618 testutil.create_request("/subthing/") 619 assert cherrypy.response.status.startswith("200") 619 620 assert url("foo") == "foo" 620 621 assert url("/foo") == "/subthing/foo" 622 testutil.create_request("/nosubthing/") 623 assert cherrypy.response.status.startswith("404") 624 assert url("foo") == "foo" 625 assert url("/foo") == "/foo" 621 626 622 627 def test_lower_approots(self): … … 624 629 assert url("/foo") == "/subthing/subsubthing/foo" 625 630 626 def test_approots_ With_path(self):631 def test_approots_with_path(self): 627 632 config.update({"server.webpath": "/coolsite/root"}) 628 633 startup.startTurboGears() … … 644 649 except cherrypy.HTTPRedirect, e: 645 650 assert "http://localhost/coolsite/root/subthing/foo" in e.urls 651 try: 652 redirect("foo") 653 assert False, "redirect exception should have been raised" 654 except cherrypy.HTTPRedirect, e: 655 assert "http://localhost/coolsite/root/subthing/foo" in e.urls 646 656 647 657 def test_multi_values(self): branches/1.1/turbogears/controllers.py
r4790 r5145 4 4 import re 5 5 import urllib 6 import urlparse 6 7 import types 7 8 from itertools import izip … … 494 495 495 496 tgpath can be a list or a string. If the path is absolute (starts 496 with a "/"), the server.webpath and the approot of the application497 a re prepended to the path. In order for the approot to be498 detected properly, the root object should extend497 with a "/"), the server.webpath, SCRIPT_NAME and the approot of the 498 application are prepended to the path. In order for the approot to 499 be detected properly, the root object should extend 499 500 controllers.RootController. 500 501 … … 507 508 """ 508 509 if not isinstance(tgpath, basestring): 509 tgpath = "/".join(list(tgpath)) 510 if tgpath.startswith("/"): 510 tgpath = '/'.join(list(tgpath)) 511 if tgpath.startswith('/'): 512 webpath = config.get('server.webpath', '').rstrip('/') 511 513 if tg_util.request_available(): 512 514 check_app_root() 513 515 tgpath = request.app_root + tgpath 514 result = config.get("server.webpath", "") + tgpath 515 else: 516 result = tgpath 516 try: 517 webpath += request.wsgi_environ['SCRIPT_NAME'].rstrip('/') 518 except (AttributeError, KeyError): 519 pass 520 tgpath = webpath + tgpath 517 521 if tgparams is None: 518 522 tgparams = kw … … 535 539 continue 536 540 if isinstance(v, unicode): 537 v = v.encode( "utf8")538 args.append( "%s=%s"% (k, urllib.quote(str(v))))541 v = v.encode('utf8') 542 args.append('%s=%s' % (k, urllib.quote(str(v)))) 539 543 if args: 540 result += "?" + "&".join(args)541 return result544 tgpath += '?' + '&'.join(args) 545 return tgpath 542 546 543 547 544 548 def check_app_root(): 545 549 """Sets request.app_root if needed.""" 546 if hasattr(request, "app_root"):550 if hasattr(request, 'app_root'): 547 551 return 548 552 found_root = False … … 564 568 if found_root and i > 0: 565 569 rootlist.insert(0, path) 566 app_root = "/".join(rootlist)567 if not app_root.startswith( "/"):568 app_root = "/"+ app_root569 if app_root.endswith( "/"):570 app_root = '/'.join(rootlist) 571 if not app_root.startswith('/'): 572 app_root = '/' + app_root 573 if app_root.endswith('/'): 570 574 app_root = app_root[:-1] 571 575 request.app_root = app_root … … 579 583 580 584 """ 585 if not redirect_path.startswith('/'): 586 path = request.object_path 587 check_app_root() 588 if path.startswith(request.app_root): 589 path = path[len(request.app_root):] 590 redirect_path = urlparse.urljoin(path, redirect_path) 581 591 raise cherrypy.HTTPRedirect(url(tgpath=redirect_path, 582 592 tgparams=redirect_params, **kw)) branches/1.1/turbogears/qstemplates/quickstart/+package+/templates/login.html
r3521 r5145 78 78 <h1>Login</h1> 79 79 <p>${message}</p> 80 <form action="${ previous_url}" method="POST">80 <form action="${tg.url(previous_url)}" method="POST"> 81 81 <table> 82 82 <tr> … … 105 105 <input py:if="forward_url" type="hidden" name="forward_url" 106 106 value="${forward_url}"/> 107 107 108 108 <div py:for="name,values in original_parameters.items()" py:strip="1"> 109 109 <input py:for="value in isinstance(values, list) and values or [values]" branches/1.1/turbogears/startup.py
r3619 r5145 11 11 import pkg_resources 12 12 import cherrypy 13 from cherrypy import _cputil 13 from cherrypy import _cputil, request, server 14 14 from formencode.variabledecode import NestedVariables 15 15 from cherrypy._cpwsgi import wsgiApp, CPHTTPRequest … … 79 79 cherrypy.lib.autoreload.reloader_thread = reloader_thread 80 80 81 webpath = ""81 webpath = '' 82 82 83 83 DNS_SD_PID = None … … 88 88 if DNS_SD_PID: 89 89 return 90 if (not hasattr(cherrypy, "root")) or (not cherrypy.root):90 if not hasattr(cherrypy, "root") or not cherrypy.root: 91 91 return 92 92 if not package: … … 128 128 That is, you can mount your app so the URI "/users/~rdel/myapp/" 129 129 maps to the root object "/". 130 130 131 """ 131 132 132 def on_start_resource(self): 133 prefix = config.get('server.webpath', False) 134 if prefix: 135 path = cherrypy.request.object_path 136 if path == prefix: 137 cherrypy.request.object_path = '/' 138 elif path.startswith(prefix): 139 cherrypy.request.object_path = path[len(prefix):] 140 else: 133 def __init__(self, webpath=''): 134 webpath = webpath.rstrip('/') 135 if webpath and not webpath.startswith('/'): 136 webpath = '/' + webpath 137 self.webpath = webpath 138 139 def before_request_body(self): 140 webpath = self.webpath 141 try: 142 webpath += request.wsgi_environ['SCRIPT_NAME'].rstrip('/') 143 except (AttributeError, KeyError): 144 pass 145 if webpath: 146 path = request.object_path 147 if path == webpath: 148 request.object_path = '/' 149 elif path.startswith(webpath): 150 request.object_path = path[len(webpath):] 151 elif not request.path.startswith(webpath): 141 152 raise cherrypy.NotFound(path) 142 153 154 143 155 class NestedVariablesFilter(object): 144 156 145 157 def before_main(self): 146 if hasattr(cherrypy.request, "params"): 147 cherrypy.request.params = \ 148 NestedVariables.to_python(cherrypy.request.params or {}) 158 if hasattr(request, 'params'): 159 request.params = NestedVariables.to_python(request.params or {}) 149 160 150 161 … … 183 194 view.loadBaseTemplates() 184 195 global webpath 185 webpath = config.get( "server.webpath", "")186 187 if hasattr(cherrypy, "root") and cherrypy.root:188 if not hasattr(cherrypy.root, "_cp_filters"):196 webpath = config.get('server.webpath', '') 197 198 if hasattr(cherrypy, 'root') and cherrypy.root: 199 if not hasattr(cherrypy.root, '_cp_filters'): 189 200 cherrypy.root._cp_filters= [] 190 morefilters = [EndTransactionsFilter(), 191 NestedVariablesFilter()] 192 if webpath: 193 morefilters.insert(0, VirtualPathFilter()) 201 morefilters = [EndTransactionsFilter(), NestedVariablesFilter()] 202 morefilters.insert(0, VirtualPathFilter(webpath)) 194 203 cherrypy.root._cp_filters.extend(morefilters) 195 204 196 if webpath.startswith("/"):197 webpath = webpath[1:]198 if webpath and not webpath.endswith("/"):199 webpath = webpath + "/" 205 webpath = webpath.lstrip('/') 206 if webpath and not webpath.endswith('/'): 207 webpath += '/' 208 200 209 isdev = config.get('server.environment') == 'development' 201 210 if not config.get("tg.new_style_logging"): … … 265 274 log.info("Scheduler stopped") 266 275 276 267 277 old_object_trail = _cputil.get_object_trail 268 278 … … 271 281 trail = old_object_trail(object_path) 272 282 try: 273 cherrypy.request.object_trail = trail283 request.object_trail = trail 274 284 except AttributeError: 275 285 pass … … 277 287 278 288 _cputil.get_object_trail = get_object_trail 289 279 290 280 291 class SimpleWSGIServer(CherryPyWSGIServer): … … 293 304 wsgi_app = EvalException(wsgi_app, global_conf={}) 294 305 cherrypy.config.update({'server.throw_errors':True}) 295 bind_addr = (conf( "server.socket_host"), conf("server.socket_port"))306 bind_addr = (conf('server.socket_host'), conf('server.socket_port')) 296 307 CherryPyWSGIServer.__init__(self, bind_addr, wsgi_app, 297 conf("server.thread_pool"), 298 conf("server.socket_host"), 299 request_queue_size = conf( 300 "server.socket_queue_size"), 301 ) 308 conf("server.thread_pool"), conf("server.socket_host"), 309 request_queue_size = conf("server.socket_queue_size")) 310 302 311 303 312 def start_server(root): 304 313 cherrypy.root = root 305 if config.get( "tg.fancy_exception", False):306 cherrypy.server.start(server=SimpleWSGIServer())314 if config.get('tg.fancy_exception', False): 315 server.start(server=SimpleWSGIServer()) 307 316 else: 308 cherrypy.server.start() 309 310 if startTurboGears not in cherrypy.server.on_start_server_list: 311 cherrypy.server.on_start_server_list.append(startTurboGears) 312 313 if stopTurboGears not in cherrypy.server.on_stop_server_list: 314 cherrypy.server.on_stop_server_list.append(stopTurboGears) 317 server.start() 318 319 320 if startTurboGears not in server.on_start_server_list: 321 server.on_start_server_list.append(startTurboGears) 322 323 if stopTurboGears not in server.on_stop_server_list: 324 server.on_stop_server_list.append(stopTurboGears) 315 325 316 326 call_on_startup = [] branches/1.1/turbogears/tests/test_controllers.py
r4817 r5145 19 19 @expose() 20 20 def index(self): 21 return url("/ Foo/")21 return url("/foo") 22 22 23 23 24 24 class MyRoot(controllers.RootController): 25 25 26 26 value = None 27 27 … … 189 189 def raise_redirect(self): 190 190 raise redirect("/foo") 191 192 @expose() 193 def relative_redirect(self): 194 raise redirect("foo") 191 195 192 196 @expose(html="turbogears.tests.simple", allow_json=True) … … 585 589 586 590 def test_approots(self): 587 config.update({"server.webpath": "/subthing"})588 self.app.get("/subthing/")589 assert url("foo") == "foo"590 assert url("/foo") == "/subthing/foo"591 response = self.app.get("/subthing/", status=200) 592 assert "/subthing/foo" in response 593 response = self.app.get("/nosubthing/", status=404) 594 assert "/subthing/foo" not in response 591 595 592 596 def test_lower_approots(self): 593 config.update({"server.webpath": "/subthing/subsubthing"}) 594 self.app.get("/subthing/subsubthing/") 595 assert url("/foo") == "/subthing/subsubthing/foo" 597 response = self.app.get("/subthing/subsubthing/") 598 assert "/subthing/subsubthing/foo" in response 596 599 597 600 def test_approots_with_path(self): 598 config.update({"server.webpath": "/coolsite/root /subthing"})599 self.app.get("/subthing/")600 assert url("/foo") == "/coolsite/root/subthing/foo"601 config.update({"server.webpath": "/coolsite/root"}) 602 response = self.app.get("/subthing/") 603 assert "/coolsite/root/subthing/foo" in response 601 604 602 605 def test_redirect(self): … … 605 608 assert response.location == 'http://localhost:80/coolsite/root/foo' 606 609 self.app.get("/raise_redirect") 610 assert response.location == 'http://localhost:80/coolsite/root/foo' 611 self.app.get("/relative_redirect") 607 612 assert response.location == 'http://localhost:80/coolsite/root/foo' 608 613 branches/1.5/turbogears/controllers.py
r5021 r5145 540 540 541 541 542 543 542 def redirect(redirect_path, redirect_params=None, **kw): 544 543 """Redirect (via cherrypy.HTTPRedirect). branches/1.5/turbogears/qstemplates/quickstart/+package+/templates/login.html
r3521 r5145 78 78 <h1>Login</h1> 79 79 <p>${message}</p> 80 <form action="${ previous_url}" method="POST">80 <form action="${tg.url(previous_url)}" method="POST"> 81 81 <table> 82 82 <tr> … … 105 105 <input py:if="forward_url" type="hidden" name="forward_url" 106 106 value="${forward_url}"/> 107 107 108 108 <div py:for="name,values in original_parameters.items()" py:strip="1"> 109 109 <input py:for="value in isinstance(values, list) and values or [values]" branches/1.5/turbogears/tests/test_controllers.py
r4962 r5145 19 19 @expose() 20 20 def index(self): 21 return url("/ Foo/")21 return url("/foo") 22 22 23 23 24 24 class MyRoot(controllers.RootController): 25 25 26 26 value = None 27 27 … … 189 189 def raise_redirect(self): 190 190 raise redirect("/foo") 191 192 @expose() 193 def relative_redirect(self): 194 raise redirect("foo") 191 195 192 196 @expose(html="turbogears.tests.simple", allow_json=True) … … 585 589 586 590 def test_approots(self): 587 config.update({"server.webpath": "/subthing"}) 588 self.app.get("/subthing/") 589 assert url("foo") == "foo" 590 assert url("/foo") == "/subthing/foo" 591 response = self.app.get("/subthing/", status=200) 592 # TODO: this works in 1.1, broken in 1.5 593 # assert "/subthing/foo" in response 594 response = self.app.get("/nosubthing/", status=404) 595 assert "/foo" not in response 591 596 592 597 def test_lower_approots(self): 593 config.update({"server.webpath": "/subthing/subsubthing"})594 self.app.get("/subthing/subsubthing/")595 assert url("/foo") == "/subthing/subsubthing/foo"598 response = self.app.get("/subthing/subsubthing/") 599 # TODO: this works in 1.1, broken in 1.5 600 # assert "/subthing/subsubthing/foo" in response 596 601 597 602 def test_approots_with_path(self): 598 config.update({"server.webpath": "/coolsite/root/subthing"}) 599 self.app.get("/subthing/") 600 assert url("/foo") == "/coolsite/root/subthing/foo" 603 config.update({"server.webpath": "/coolsite/root"}) 604 response = self.app.get("/subthing/") 605 # TODO: this works in 1.1, broken in 1.5 606 # assert "/coolsite/root/subthing/foo" in response 601 607 602 608 def test_redirect(self): … … 605 611 assert response.location == 'http://localhost:80/coolsite/root/foo' 606 612 self.app.get("/raise_redirect") 613 assert response.location == 'http://localhost:80/coolsite/root/foo' 614 self.app.get("/relative_redirect") 607 615 assert response.location == 'http://localhost:80/coolsite/root/foo' 608 616