[Jifty-commit] r3410 - in jifty/trunk/lib/Jifty: .
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Fri Jun 8 17:21:24 EDT 2007
Author: clkao
Date: Fri Jun 8 17:21:23 2007
New Revision: 3410
Modified:
jifty/trunk/lib/Jifty/Continuation.pm
jifty/trunk/lib/Jifty/Plugin/SinglePage/Dispatcher.pm
jifty/trunk/lib/Jifty/Web.pm
Log:
misc webservices_redirect cleanup.
Modified: jifty/trunk/lib/Jifty/Continuation.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Continuation.pm (original)
+++ jifty/trunk/lib/Jifty/Continuation.pm Fri Jun 8 17:21:23 2007
@@ -159,13 +159,7 @@
Jifty->log->debug("Redirect to @{[$self->request->path]} via continuation");
if (Jifty->web->request->argument('_webservice_redirect')) {
# for continuation - perform internal redirect under webservices.
- Jifty->web->request->remove_state_variable('region-__page');
- Jifty->web->request->add_fragment(
- name => '__page',
- path => $self->request->path,
- arguments => {},
- wrapper => 0
- );
+ Jifty->web->webservices_redirect($self->request->path);
return;
}
# If we needed to fix up the path (it contains invalid
Modified: jifty/trunk/lib/Jifty/Plugin/SinglePage/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/SinglePage/Dispatcher.pm (original)
+++ jifty/trunk/lib/Jifty/Plugin/SinglePage/Dispatcher.pm Fri Jun 8 17:21:23 2007
@@ -16,19 +16,13 @@
on qr{(__jifty/webservices/.*)} => run {
my $actions = get '_webservice_redirect';
- Jifty->web->request->remove_state_variable('region-__page');
for my $act (@$actions) {
- if ($act =~ m{^https?://}) {
- set '_webservice_external_redirect' => $act;
- }
- else {
- Jifty->web->request->add_fragment(
- name => '__page',
- path => $act,
- arguments => {},
- wrapper => 0
- );
- }
+ if ($act =~ m{^https?://}) {
+ set '_webservice_external_redirect' => $act;
+ }
+ else {
+ Jifty->web->webservices_redirect($act);
+ }
}
show $1;
};
Modified: jifty/trunk/lib/Jifty/Web.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web.pm (original)
+++ jifty/trunk/lib/Jifty/Web.pm Fri Jun 8 17:21:23 2007
@@ -305,23 +305,12 @@
= $self->_validate_request_actions();
# In the case where we have a continuation and want to redirect
- # {XXX TODO - should be refactored out to the SinglePageApp plugin
-
if ( $self->request->continuation_path && Jifty->web->request->argument('_webservice_redirect') ) {
-
# for continuation - perform internal redirect under webservices
- Jifty->web->request->remove_state_variable('region-__page');
- Jifty->web->request->add_fragment(
- name => '__page',
- path => $self->request->continuation_path,
- arguments => {},
- wrapper => 0
- );
+ $self->webservices_redirect($self->request->continuation_path);
return;
}
- # }
-
$self->request->save_continuation;
unless ( $self->request->just_validating ) {
@@ -656,6 +645,27 @@
}
}
+=head3 webservices_redirect [TO]
+
+Handle redirection inside webservices call. This is meant to be
+hooked by plugin that knows what to do with it.
+
+=cut
+
+sub webservices_redirect {
+ my ( $self, $to ) = @_;
+ # XXX: move to singlepage plugin
+ my ($spa) = Jifty->find_plugin('Jifty::Plugin::SinglePage') or return;
+
+ Jifty->web->request->remove_state_variable( 'region-'.$spa->region_name );
+ Jifty->web->request->add_fragment(
+ name => $spa->region_name,
+ path => $to,
+ arguments => {},
+ wrapper => 0
+ );
+}
+
=head3 redirect [TO]
Redirect to the next page. If you pass this method a parameter, it
More information about the Jifty-commit
mailing list