[Jifty-commit] r564 - in jifty/trunk: lib/Jifty
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Thu Feb 9 06:17:57 EST 2006
Author: alexmv
Date: Thu Feb 9 06:17:56 2006
New Revision: 564
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Continuation.pm
jifty/trunk/lib/Jifty/Dispatcher.pm
jifty/trunk/lib/Jifty/Handler.pm
Log:
r9018 at zoq-fot-pik: chmrr | 2006-02-09 06:17:12 -0500
* last_rule does the wrong thing when calling continuations -- it can
cause nothing to be rendered (!)
* The response of a GET request in the second phase of a continuation
call can have results in it already, if they were added based on
the dispatcher, for example. Those results (call then "C") take
priority over the results saved in the continuation (call them
"B"), which in turn took priority over results the earlier versions
of "C" (call then "A") which happened before the continuation was
pushed.
Because of this, we can't just load the whole response up, but
instead have to copy results out of it.
Modified: jifty/trunk/lib/Jifty/Continuation.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Continuation.pm (original)
+++ jifty/trunk/lib/Jifty/Continuation.pm Thu Feb 9 06:17:56 2006
@@ -181,15 +181,26 @@
} else {
# Pull state information out of the continuation and set it
# up; we use clone so that the continuation itself is
- # immutable.
+ # immutable. It is vaguely possible that there are results in
+ # the response already (set up by the dispatcher) so we place
+ # results from the continuation's response into the existing
+ # response only if it wouldn't clobber something.
+ my %results = $self->response->results;
+ Jifty->web->response->result($_,Clone::clone($results{$_}))
+ for grep {not Jifty->web->response->result($_)} keys %results;
- # TODO: maybe not use clone? Use something happier?
- Jifty->web->response( Clone::clone($self->response) ) if $self->response;
+ # Run any code in the continuation
$self->code->(Jifty->web->request)
if $self->code;
- local Jifty->web->{request} = Clone::clone($self->request);
- Jifty->handler->dispatcher->handle_request();
- Jifty::Dispatcher::last_rule();
+
+ # Enter the request in the continuation, and handle it
+ Jifty->web->request(Clone::clone($self->request));
+ Jifty->web->handle_request();
+
+ # Now we want to skip the rest of the
+ # Jifty::Web->handle_request that we were called from. Pop up
+ # to the dispatcher
+ Jifty::Dispatcher::next_show();
}
}
Modified: jifty/trunk/lib/Jifty/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Dispatcher.pm (original)
+++ jifty/trunk/lib/Jifty/Dispatcher.pm Thu Feb 9 06:17:56 2006
@@ -474,6 +474,7 @@
sub next_rule { next RULE }
sub last_rule { last HANDLER }
+sub next_show { last HANDLE_WEB }
=head2 _do_under
@@ -695,7 +696,9 @@
eval {
HANDLER: {
$self->_handle_rules( [ $self->rules('SETUP') ] );
- Jifty->web->handle_request();
+ HANDLE_WEB: {
+ Jifty->web->handle_request();
+ }
$self->_handle_rules( [ $self->rules('RUN'), 'show' ] );
$self->_handle_rules( [ $self->rules('CLEANUP') ] );
}
Modified: jifty/trunk/lib/Jifty/Handler.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Handler.pm (original)
+++ jifty/trunk/lib/Jifty/Handler.pm Thu Feb 9 06:17:56 2006
@@ -92,6 +92,8 @@
local $HTML::Mason::Commands::JiftyWeb = Jifty::Web->new();
Jifty->web->request(Jifty::Request->new()->fill($args{cgi}));
+ Jifty->log->debug("Recieved request for ".Jifty->web->request->path);
+
$self->mason(Jifty::MasonHandler->new(
$self->mason_config,
cgi => $args{cgi},
More information about the Jifty-commit
mailing list