Changeset 5193
- Timestamp:
- 08/21/08 20:49:22 (3 months ago)
- Files:
-
- branches/1.1/turbogears/controllers.py (modified) (1 diff)
- branches/1.1/turbogears/tests/test_controllers.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/turbogears/controllers.py
r5145 r5193 540 540 if isinstance(v, unicode): 541 541 v = v.encode('utf8') 542 args.append( '%s=%s' % (k, urllib.quote(str(v))))542 args.append((k, str(v))) 543 543 if args: 544 tgpath += '?' + '&'.join(args) 544 query_string = urllib.urlencode(args, True) 545 if '?' in tgpath: 546 tgpath += '&' + query_string 547 else: 548 tgpath += '?' + query_string 545 549 return tgpath 546 550 branches/1.1/turbogears/tests/test_controllers.py
r5171 r5193 574 574 testutil.mount(SubApp(), '/subthing/subsubthing') 575 575 576 def tearDown(self): 577 testutil.TGWebTest.tearDown(self) 578 config.update({"server.webpath": ""}) 579 576 580 def test_basic_urls(self): 577 581 self.app.get("/") … … 636 640 ) == '/?foo=bar&foo=%C3%A0' 637 641 638 def tearDown(self): 639 testutil.TGWebTest.tearDown(self) 640 config.update({"server.webpath": ""}) 641 642 def test_existing_query_string(self): 643 """url() can handle URL with existing query string""" 644 self.app.get("/") 645 test_url = url('/foo', {'first': 1}) 646 assert url(test_url, {'second': 2}) == '/foo?first=1&second=2' 642 647 643 648 def test_index_trailing_slash(self): … … 663 668 664 669 def test_url_kwargs_overwrite_tgparams(self): 665 """ Check keys in tgparams in call to urloverwrite kw args"""670 """Keys in tgparams in call to url() overwrite kw args""" 666 671 params = {'spamm': 'eggs'} 667 672 assert 'spamm=ham' in url('/foo', params, spamm='ham') 668 673 669 674 def test_url_doesnt_change_tgparams(self): 670 """ Test thaturl() does not change the dict passed as second arg"""675 """url() does not change the dict passed as second arg""" 671 676 params = {'spamm': 'eggs'} 672 677 assert 'foo' in url('/foo', params, spamm='ham')