[Catalyst-commits] r12835 - in Catalyst-Runtime/5.80/trunk: . lib
t/aggregate
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Mon Feb 8 21:46:16 GMT 2010
Author: t0m
Date: 2010-02-08 21:46:15 +0000 (Mon, 08 Feb 2010)
New Revision: 12835
Modified:
Catalyst-Runtime/5.80/trunk/
Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_action_chained.t
Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_uri_for_multibytechar.t
Log:
r12572 at t0mlaptop (orig r12537): caelum | 2010-01-06 22:33:51 +0000
branch to utf8-decode captures and args
r12573 at t0mlaptop (orig r12538): caelum | 2010-01-06 22:56:59 +0000
utf8::decode captures and args, and uri-escape captures
r12574 at t0mlaptop (orig r12539): caelum | 2010-01-07 00:04:45 +0000
add a test for the uri_for utf8 stuff
r12869 at t0mlaptop (orig r12834): t0m | 2010-02-08 21:20:05 +0000
Unfuck
Property changes on: Catalyst-Runtime/5.80/trunk
___________________________________________________________________
Name: svk:merge
- 1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst/trunk/Catalyst-Runtime:9763
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/branches/compres:7999
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/branches/context_go:8001
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/trunk:8533
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/Catalyst-Test-Updates:8363
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/add_captures_to_visit:9546
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/aggregate_more:11803
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/better_scripts:12074
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/disable_regex_fallback:11456
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/fix_path_info_decoding:12089
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/index_default_fuckage:10646
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/moose:7911
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/namespace_handling_refactor:10655
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/uri_encode_captures_andor_args_take2:11811
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-ChildOf:4443
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-Runtime-jrockway:5857
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-component-setup:4320
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-docs:4325
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/current/Catalyst-Runtime:5142
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst:4483
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst-Runtime:6165
6d45476b-5895-46b8-b13a-8b969fa34c98:/local/Catalyst-Runtime-better_scripts:11331
8a9521aa-ff93-41d6-9f87-b05cafcdab40:/local/cat/Catalyst-Runtime/5.80/trunk:8157
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime:8339
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime-jrockway:8342
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime:6511
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime-current:10442
+ 1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst/trunk/Catalyst-Runtime:9763
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/branches/compres:7999
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/branches/context_go:8001
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/trunk:8533
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/Catalyst-Test-Updates:8363
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/add_captures_to_visit:9546
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/aggregate_more:11803
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/better_scripts:12074
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/disable_regex_fallback:11456
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/fix_path_info_decoding:12089
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/index_default_fuckage:10646
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/moose:7911
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/namespace_handling_refactor:10655
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/uri_encode_captures_andor_args_take2:11811
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/uri_for_utf8:12834
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-ChildOf:4443
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-Runtime-jrockway:5857
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-component-setup:4320
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-docs:4325
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/current/Catalyst-Runtime:5142
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst:4483
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst-Runtime:6165
6d45476b-5895-46b8-b13a-8b969fa34c98:/local/Catalyst-Runtime-better_scripts:11331
8a9521aa-ff93-41d6-9f87-b05cafcdab40:/local/cat/Catalyst-Runtime/5.80/trunk:8157
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime:8339
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime-jrockway:8342
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime:6511
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime-current:10442
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm 2010-02-08 21:20:05 UTC (rev 12834)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm 2010-02-08 21:46:15 UTC (rev 12835)
@@ -1265,6 +1265,9 @@
( scalar @args && ref $args[$#args] eq 'HASH' ? pop @args : {} );
carp "uri_for called with undef argument" if grep { ! defined $_ } @args;
+ foreach my $arg (@args) {
+ utf8::encode($arg) if utf8::is_utf8($arg);
+ }
s/([^$URI::uric])/$URI::Escape::escapes{$1}/go for @args;
if (blessed $path) { # Action object only.
s|/|%2F|g for @args;
@@ -1275,6 +1278,12 @@
( scalar @args && ref $args[0] eq 'ARRAY'
? @{ shift(@args) }
: ()) ];
+
+ foreach my $capture (@$captures) {
+ utf8::encode($capture) if utf8::is_utf8($capture);
+ $capture =~ s/([^$URI::uric])/$URI::Escape::escapes{$1}/go;
+ }
+
my $action = $path;
$path = $c->dispatcher->uri_for_action($action, $captures);
if (not defined $path) {
@@ -1285,6 +1294,8 @@
$path = '/' if $path eq '';
}
+ undef($path) if (defined $path && $path eq '');
+
unshift(@args, $path);
unless (defined $path && $path =~ s!^/!!) { # in-place strip
@@ -1316,7 +1327,6 @@
(map {
my $param = "$_";
utf8::encode( $param ) if utf8::is_utf8($param);
- # using the URI::Escape pattern here so utf8 chars survive
$param =~ s/([^A-Za-z0-9\-_.!~*'() ])/$URI::Escape::escapes{$1}/go;
$param =~ s/ /+/g;
"${key}=$param"; } ( ref $val eq 'ARRAY' ? @$val : $val ));
Modified: Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_action_chained.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_action_chained.t 2010-02-08 21:20:05 UTC (rev 12834)
+++ Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_action_chained.t 2010-02-08 21:46:15 UTC (rev 12835)
@@ -1074,6 +1074,7 @@
['foo%2Fbar', 'baz%2Fquux'],
['foo%2Fbar', 'baz%2Fquux', { foo => 'bar', 'baz' => 'quux%2Ffrood'}],
['foo%2Fbar', 'baz%2Fquux', { foo => 'bar', 'baz%2Ffnoo' => 'quux%2Ffrood'}],
+ ['h%C3%BCtte', 'h%C3%BCtte', { test => 'h%C3%BCtte' } ],
) {
my $path = '/chained/roundtrip_urifor/' .
$thing->[0] . '/' . $thing->[1];
Modified: Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_uri_for_multibytechar.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_uri_for_multibytechar.t 2010-02-08 21:20:05 UTC (rev 12834)
+++ Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_uri_for_multibytechar.t 2010-02-08 21:46:15 UTC (rev 12835)
@@ -1,10 +1,9 @@
use strict;
use warnings;
-
use FindBin;
use lib "$FindBin::Bin/../lib";
-use Test::More tests => 5;
+use Test::More;
use_ok('TestApp');
@@ -33,3 +32,19 @@
# multibyte with utf8 string
is($context->uri_for('/', { name => "\x{6751}\x{702c}\x{5927}\x{8f14}" }), $uri_with_multibyte, 'uri_for with utf8 string query');
is($context->req->uri_with({ name => "\x{6751}\x{702c}\x{5927}\x{8f14}" }), $uri_with_multibyte, 'uri_with with utf8 string query');
+
+# multibyte captures and args
+my $action = $context->controller('Action::Chained')
+ ->action_for('roundtrip_urifor_end');
+
+{
+use utf8;
+
+is($context->uri_for($action, ['hütte'], 'hütte', {
+ test => 'hütte'
+}),
+'http://127.0.0.1/chained/roundtrip_urifor/h%C3%BCtte/h%C3%BCtte?test=h%C3%BCtte',
+'uri_for with utf8 captures and args');
+}
+
+done_testing;
More information about the Catalyst-commits
mailing list