[Jifty-commit] r6259 - in jifty/trunk: lib/Jifty/View/Declare lib/Jifty/View/Mason lib/Jifty/Web
Jifty commits
jifty-commit at lists.jifty.org
Thu Jan 22 14:28:08 EST 2009
Author: alexmv
Date: Thu Jan 22 14:28:07 2009
New Revision: 6259
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/View/Declare/BaseClass.pm
jifty/trunk/lib/Jifty/View/Declare/Helpers.pm
jifty/trunk/lib/Jifty/View/Mason/Handler.pm
jifty/trunk/lib/Jifty/Web/PageRegion.pm
Log:
r41132 at kohr-ah: chmrr | 2009-01-22 14:24:07 -0500
* Glue Mason's output more directly onto S::BS; fixes more intercall issues
Modified: jifty/trunk/lib/Jifty/View/Declare/BaseClass.pm
==============================================================================
--- jifty/trunk/lib/Jifty/View/Declare/BaseClass.pm (original)
+++ jifty/trunk/lib/Jifty/View/Declare/BaseClass.pm Thu Jan 22 14:28:07 2009
@@ -47,7 +47,7 @@
local $HTML::Mason::Commands::m = $req;
local $HTML::Mason::Commands::r = Jifty->handler->apache;
$req->comp(
- {content => sub {$code->()}, store => \$req->{request_buffer}},
+ {content => sub {$code->()}},
$wrapper,
%{$args}
);
Modified: jifty/trunk/lib/Jifty/View/Declare/Helpers.pm
==============================================================================
--- jifty/trunk/lib/Jifty/View/Declare/Helpers.pm (original)
+++ jifty/trunk/lib/Jifty/View/Declare/Helpers.pm Thu Jan 22 14:28:07 2009
@@ -346,11 +346,7 @@
$args->{path} = $Template::Declare::Tags::self->path_for($path);
}
local $Template::Declare::Tags::self = undef;
- Template::Declare->new_buffer_frame;
Jifty::Web::PageRegion->new(%$args)->render;
- my $content = Template::Declare->buffer->data();
- Template::Declare->end_buffer_frame;
- Jifty->web->out($content);
}
Modified: jifty/trunk/lib/Jifty/View/Mason/Handler.pm
==============================================================================
--- jifty/trunk/lib/Jifty/View/Mason/Handler.pm (original)
+++ jifty/trunk/lib/Jifty/View/Mason/Handler.pm Thu Jan 22 14:28:07 2009
@@ -56,7 +56,7 @@
my %p = @_ || $package->config;
my $self = $package->SUPER::new( request_class => 'HTML::Mason::Request::Jifty',
- out_method => sub {Jifty->handler->buffer->append(@_)},
+ out_method => sub {Carp::cluck("Mason output skipped Jifty's output stack!")},
%p );
$self->interp->compiler->add_allowed_globals('$r');
$self->interp->set_escape( h => \&escape_utf8 );
@@ -98,7 +98,6 @@
[application => Jifty::Util->absolute_path( Jifty->config->framework('Web')->{'TemplateRoot'} )],
],
%{ Jifty->config->framework('Web')->{'MasonConfig'} },
- autoflush => 1, # Now forced on
);
my $root_serial = 0;
@@ -117,6 +116,10 @@
$config{static_source} = 0;
$config{use_object_files} = 0;
}
+
+ # We require autoflush now.
+ $config{autoflush} = 1;
+
return %config;
}
@@ -293,6 +296,41 @@
}
}
+sub print {
+ shift;
+ Jifty->handler->buffer->append(@_);
+}
+
+*out = \&print;
+
+sub comp {
+ my $self = shift;
+
+ my %mods;
+ %mods = (%{shift()}, %mods) while ref($_[0]) eq 'HASH';
+ my @args;
+ push @args, buffer => delete $mods{store} if $mods{store} and $mods{store} ne \($self->{request_buffer});
+ Jifty->handler->buffer->push(@args, from => "Mason path ".(ref $_[0] ? $_[0]{path} : $_[0]));
+
+ my $wantarray = wantarray;
+ my @result;
+ eval {
+ if ($wantarray) {
+ @result = $self->SUPER::comp(\%mods, @_);
+ } elsif (defined $wantarray) {
+ $result[0] = $self->SUPER::comp(\%mods, @_);
+ } else {
+ $self->SUPER::comp(\%mods, @_);
+ }
+ };
+ my $error = $@;
+
+ Jifty->handler->buffer->pop;
+
+ rethrow_exception $error if $error;
+ return $wantarray ? @result : $result[0];
+}
+
=head2 redirect
Calls L<Jifty::Web/redirect>.
Modified: jifty/trunk/lib/Jifty/Web/PageRegion.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/PageRegion.pm (original)
+++ jifty/trunk/lib/Jifty/Web/PageRegion.pm Thu Jan 22 14:28:07 2009
@@ -272,7 +272,7 @@
sub as_string {
my $self = shift;
- Jifty->handler->buffer->push(private => 1);
+ Jifty->handler->buffer->push(private => 1, from => "PageRegion render of ".$self->path);
$self->render;
return Jifty->handler->buffer->pop;
}
@@ -324,9 +324,6 @@
}
}
- # Make mason flush from its buffers into our String::BufferStack
- $HTML::Mason::Commands::m->flush_buffer if $HTML::Mason::Commands::m;
-
$self->render_as_subrequest(\%arguments);
$buffer->append(qq|</div>|) if ( $self->region_wrapper );
More information about the Jifty-commit
mailing list