Warning:
Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.
Ticket #1456: url_multi_value_fixed.patch
| File url_multi_value_fixed.patch,
1.6 KB
(added by imix, 4 years ago) |
|
|
-
|
|
|
|
| 512 | 512 | else: |
| 513 | 513 | pairs = [(key, value)] |
| 514 | 514 | for (k,v) in pairs: |
| 515 | | if isinstance(value, unicode): |
| 516 | | value = value.encode("utf8") |
| | 515 | if isinstance(v, unicode): |
| | 516 | v = v.encode("utf8") |
| 517 | 517 | args.append("%s=%s" % (k, urllib.quote(str(v)))) |
| 518 | 518 | if args: |
| 519 | 519 | result += "?" + "&".join(args) |
-
|
|
|
|
| 572 | 572 | assert url("/foo", bar=("asdf","qwer")) in \ |
| 573 | 573 | ["/foo?bar=qwer&bar=asdf", "/foo?bar=asdf&bar=qwer"] |
| 574 | 574 | |
| | 575 | def test_unicode(self): |
| | 576 | "tg.url can handle unicode parameters" |
| | 577 | assert url('/',x= |
| | 578 | u'\N{LATIN SMALL LETTER A WITH GRAVE}'+ |
| | 579 | u'\N{LATIN SMALL LETTER E WITH GRAVE}'+ |
| | 580 | u'\N{LATIN SMALL LETTER I WITH GRAVE}'+ |
| | 581 | u'\N{LATIN SMALL LETTER O WITH GRAVE}'+ |
| | 582 | u'\N{LATIN SMALL LETTER U WITH GRAVE}') == '/?x=%C3%A0%C3%A8%C3%AC%C3%B2%C3%B9' |
| | 583 | |
| | 584 | def test_list(self): |
| | 585 | "tg.url can handle list parameters, with unicode too" |
| | 586 | assert url('/',foo=['bar', u'\N{LATIN SMALL LETTER A WITH GRAVE}']) == '/?foo=bar&foo=%C3%A0' |
| | 587 | |
| | 588 | |
| 575 | 589 | def tearDown(self): |
| 576 | 590 | turbogears.config.update({"server.webpath" : ""}) |
| 577 | 591 | turbogears.startup.startTurboGears() |
Download in other formats: