[Catalyst-commits] r13411 - in
Catalyst-Plugin-Session-State-URI/trunk: .
lib/Catalyst/Plugin/Session/State t t/lib/Catalyst/Plugin/Test
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Mon Jul 19 19:08:50 GMT 2010
Author: t0m
Date: 2010-07-19 20:08:50 +0100 (Mon, 19 Jul 2010)
New Revision: 13411
Modified:
Catalyst-Plugin-Session-State-URI/trunk/Changes
Catalyst-Plugin-Session-State-URI/trunk/Makefile.PL
Catalyst-Plugin-Session-State-URI/trunk/lib/Catalyst/Plugin/Session/State/URI.pm
Catalyst-Plugin-Session-State-URI/trunk/t/basic.t
Catalyst-Plugin-Session-State-URI/trunk/t/lib/Catalyst/Plugin/Test/Plugin.pm
Catalyst-Plugin-Session-State-URI/trunk/t/param.t
Catalyst-Plugin-Session-State-URI/trunk/t/uri_find_regression_avoid_RT44593.t
Log:
Fix RT#56753
Modified: Catalyst-Plugin-Session-State-URI/trunk/Changes
===================================================================
--- Catalyst-Plugin-Session-State-URI/trunk/Changes 2010-07-16 17:45:09 UTC (rev 13410)
+++ Catalyst-Plugin-Session-State-URI/trunk/Changes 2010-07-19 19:08:50 UTC (rev 13411)
@@ -1,5 +1,10 @@
Revision history for Perl extension Catalyst::Plugin::Session::State::URI
+0.14 2010-07-19
+ - Fix behaviour when debug is turned on by wrapping prepare_path
+ rather than prepare_action (RT#56753).
+ - Fix warning about test plugin inheriting from Catalyst::Component.
+
0.13 2009-10-16
- Port to new session config key.
- Port to Moose.
Modified: Catalyst-Plugin-Session-State-URI/trunk/Makefile.PL
===================================================================
--- Catalyst-Plugin-Session-State-URI/trunk/Makefile.PL 2010-07-16 17:45:09 UTC (rev 13410)
+++ Catalyst-Plugin-Session-State-URI/trunk/Makefile.PL 2010-07-19 19:08:50 UTC (rev 13411)
@@ -15,6 +15,8 @@
requires 'Moose';
requires 'MooseX::Emulate::Class::Accessor::Fast';
+test_requires 'Class::Data::Inheritable';
+
auto_install;
resources repository => 'http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Plugin-Session-State-URI/';
Modified: Catalyst-Plugin-Session-State-URI/trunk/lib/Catalyst/Plugin/Session/State/URI.pm
===================================================================
--- Catalyst-Plugin-Session-State-URI/trunk/lib/Catalyst/Plugin/Session/State/URI.pm 2010-07-16 17:45:09 UTC (rev 13410)
+++ Catalyst-Plugin-Session-State-URI/trunk/lib/Catalyst/Plugin/Session/State/URI.pm 2010-07-19 19:08:50 UTC (rev 13411)
@@ -312,9 +312,11 @@
return 1;
}
-sub prepare_action {
+sub prepare_path {
my $c = shift;
+ $c->maybe::next::method(@_);
+
if ( my $param = $c->_session_plugin_config->{param} )
{ # use param style rewriting
@@ -334,8 +336,6 @@
}
}
-
- $c->maybe::next::method(@_);
}
__PACKAGE__
@@ -485,7 +485,7 @@
=over 4
-=item prepare_action
+=item prepare_path
Will restore the session if the request URI is formatted accordingly, and
rewrite the URI to remove the additional part.
@@ -531,7 +531,7 @@
To exclude some sections of your application, like a goodbye page (see
L</CAVEATS>) you should make extend the C<session_should_rewrite_uri> method to
return true if the URI does not point to the goodbye page, extend
-C<prepare_action> to not rewrite URIs that match C</-/> (so that external URIs
+C<prepare_path> to not rewrite URIs that match C</-/> (so that external URIs
with that in their path as a parameter to the goodbye page will not be
destroyed) and finally extend C<uri_with_sessionid> to rewrite URIs with the
following logic:
Modified: Catalyst-Plugin-Session-State-URI/trunk/t/basic.t
===================================================================
--- Catalyst-Plugin-Session-State-URI/trunk/t/basic.t 2010-07-16 17:45:09 UTC (rev 13410)
+++ Catalyst-Plugin-Session-State-URI/trunk/t/basic.t 2010-07-19 19:08:50 UTC (rev 13411)
@@ -105,12 +105,12 @@
);
}
-can_ok( $m, "prepare_action" );
+can_ok( $m, "prepare_path" );
$cxt->clear;
$req->path("somereq");
-$cxt->prepare_action;
+$cxt->prepare_path;
ok( !$cxt->called("sessionid"),
"didn't try setting session ID when there was nothing to set it by" );
@@ -118,14 +118,14 @@
$req->path("some_req/-/the session id");
ok( !$cxt->get_session_id, "no session ID yet" );
-$cxt->prepare_action;
+$cxt->prepare_path;
is( $cxt->get_session_id, "the session id", "session ID was restored from URI" );
is( $req->path, "some_req", "request path was rewritten" );
$sessionid = undef;
$req->path("-/the session id"); # sri's bug
ok( !$cxt->get_session_id, "no session ID yet" );
-$cxt->prepare_action;
+$cxt->prepare_path;
is(
$cxt->get_session_id,
"the session id",
Modified: Catalyst-Plugin-Session-State-URI/trunk/t/lib/Catalyst/Plugin/Test/Plugin.pm
===================================================================
--- Catalyst-Plugin-Session-State-URI/trunk/t/lib/Catalyst/Plugin/Test/Plugin.pm 2010-07-16 17:45:09 UTC (rev 13410)
+++ Catalyst-Plugin-Session-State-URI/trunk/t/lib/Catalyst/Plugin/Test/Plugin.pm 2010-07-19 19:08:50 UTC (rev 13411)
@@ -1,11 +1,10 @@
package Catalyst::Plugin::Test::Plugin;
use strict;
+use base qw/Class::Data::Inheritable/;
-use base qw/Catalyst::Controller/;
+__PACKAGE__->mk_classdata('ran_setup');
- __PACKAGE__->mk_classdata('ran_setup');
-
sub setup {
my $c = shift;
$c->ran_setup('1');
Modified: Catalyst-Plugin-Session-State-URI/trunk/t/param.t
===================================================================
--- Catalyst-Plugin-Session-State-URI/trunk/t/param.t 2010-07-16 17:45:09 UTC (rev 13410)
+++ Catalyst-Plugin-Session-State-URI/trunk/t/param.t 2010-07-19 19:08:50 UTC (rev 13411)
@@ -94,7 +94,7 @@
"binary media type should not be rewritten"
);
-can_ok( $m, "prepare_action" );
+can_ok( $m, "prepare_path" );
can_ok( $m, "finalize" );
Modified: Catalyst-Plugin-Session-State-URI/trunk/t/uri_find_regression_avoid_RT44593.t
===================================================================
--- Catalyst-Plugin-Session-State-URI/trunk/t/uri_find_regression_avoid_RT44593.t 2010-07-16 17:45:09 UTC (rev 13410)
+++ Catalyst-Plugin-Session-State-URI/trunk/t/uri_find_regression_avoid_RT44593.t 2010-07-19 19:08:50 UTC (rev 13411)
@@ -41,7 +41,7 @@
$cxt->setup_session;
$req->path("-/the session id"); # sri's bug
-$cxt->prepare_action;
+$cxt->prepare_path;
$res->body( my $body_ext_url = qq{foo <a href="$uri"></a> blah} );
More information about the Catalyst-commits
mailing list