I spent some time wrapping my brain around continuations in Jifty. Sure,
they are cool and useful, but I needed continuation after results are
displayed to user (and thus after take_action). Since Jifty creates
continuation before take_action (but after validate etc.) I needed to
make something like this:
in Dispatcher.pm:
my $next = Jifty->web->request->continuation;
if (Jifty->web->response->results) {
$next = Jifty::Continuation->new(
request => Jifty->web->request,
response => Jifty->web->response,
);
} elsif ($next) {
$next->call;
}
set 'filter' => Jifty->web->new_action(
class => 'Filter',
moniker => 'filter_list',
);
set 'next' => $next;
show '/list';
in share/web/templates/list:
<%args>
$filter
$next
</%args>
<% Jifty->web->tangent(
url => '/rev/' . $r->revision,
label => $r->revision,
continuation => $next,
) %>
Now, I'm wondering if this is correct pattern for such a case. In
Filter action I actually create some Jifty->web->response->results and
use that (in dispatcher) to decide should I create continuation or not.
I tried to create continuation directly in action, but I didn't manage
to make it work.
I have feeling that I'm manually poking through Jifty Continuation (and
this example does create two nested continuations), but it works for me.
Is this example interesting enough to be included in Cookbook?
BTW, whole app is trivial subversion browser (which imports revision
data into Jifty models) and is available at
http://svn.rot13.org/index.cgi/SVNBrowser/browse/trunk/
if somebody wants to take a closer look at it.
--
Dobrica Pavlinusic 2share!2flame [EMAIL PROTECTED]
Unix addict. Internet consultant. http://www.rot13.org/~dpavlin
_______________________________________________
jifty-devel mailing list
[email protected]
http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel