[Catalyst-commits] r13010 - in Catalyst-Runtime/5.80/trunk: .
lib/Catalyst/DispatchType t/aggregate
matthewt at dev.catalyst.perl.org
matthewt at dev.catalyst.perl.org
Fri Mar 5 03:36:57 GMT 2010
Author: matthewt
Date: 2010-03-05 03:36:57 +0000 (Fri, 05 Mar 2010)
New Revision: 13010
Modified:
Catalyst-Runtime/5.80/trunk/Changes
Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Index.pm
Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_uri_for.t
Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_uri_for_action.t
Log:
fix Index uri_for_action bug
Modified: Catalyst-Runtime/5.80/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.80/trunk/Changes 2010-03-05 02:16:07 UTC (rev 13009)
+++ Catalyst-Runtime/5.80/trunk/Changes 2010-03-05 03:36:57 UTC (rev 13010)
@@ -1,5 +1,9 @@
# This file documents the revision history for Perl extension Catalyst.
+ Bug fixed:
+ - DispatchType::Index's uri_for_action only returns for actions registered
+ with it (prevents 'index :Path' or similar resolving to the wrong URI)
+
5.80021 2010-03-03 23:02:01
Bug fixed:
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Index.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Index.pm 2010-03-05 02:16:07 UTC (rev 13009)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Index.pm 2010-03-05 03:36:57 UTC (rev 13010)
@@ -67,7 +67,7 @@
sub register {
my ( $self, $c, $action ) = @_;
- $self->_actions->{ $action->reverse } = $action;
+ $self->_actions->{ $action->reverse } = $action if $action->name eq 'index';
return 1;
}
@@ -84,7 +84,7 @@
return undef if @$captures;
- return undef unless $action->name eq 'index';
+ return undef unless exists $self->_actions->{ $action->reverse };
return "/".$action->namespace;
}
Modified: Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_uri_for.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_uri_for.t 2010-03-05 02:16:07 UTC (rev 13009)
+++ Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_uri_for.t 2010-03-05 03:36:57 UTC (rev 13010)
@@ -159,6 +159,17 @@
);
}
+{
+ my $index_not_private = $dispatcher->get_action_by_path(
+ '/action/chained/argsorder/index'
+ );
+ is(
+ Catalyst::uri_for( $context, $index_not_private )->as_string,
+ 'http://127.0.0.1/argsorder',
+ 'Return non-DispatchType::Index path for index action with args'
+ );
+}
+
done_testing;
Modified: Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_uri_for_action.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_uri_for_action.t 2010-03-05 02:16:07 UTC (rev 13009)
+++ Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_uri_for_action.t 2010-03-05 03:36:57 UTC (rev 13010)
@@ -21,6 +21,8 @@
'/class_forward_test_method'
);
+warn $dispatcher->uri_for_action($private_action);
+
ok(!defined($dispatcher->uri_for_action($private_action)),
"Private action returns undef for URI");
More information about the Catalyst-commits
mailing list