diff options
author | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2009-03-11 20:53:18 +0000 |
---|---|---|
committer | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2009-03-11 20:53:18 +0000 |
commit | bdfdc97f2f79c7072b5d288344775b9d48968941 (patch) | |
tree | 11d6961cebede45fbfe196a5a0f5cd41263e8ca5 | |
parent | aca8cf99ff35c52ec5263be6ddf10e8bf50fb1a7 (diff) | |
download | reaction-bdfdc97f2f79c7072b5d288344775b9d48968941.tar.gz reaction-bdfdc97f2f79c7072b5d288344775b9d48968941.zip |
dont make events happen unless necesary
-rw-r--r-- | Changes | 3 | ||||
-rw-r--r-- | lib/Reaction/UI/Window.pm | 9 |
2 files changed, 8 insertions, 4 deletions
@@ -10,6 +10,9 @@ Revision history for Reaction - Added an example to ComponentUI - Add support for the external MooseX::Types::Common and MooseX::Types::DateTime type libraries in the VPs + - Eliminate memory leak related to InstancePerContext + - Move the short-cut code from flush_view to flush to prevent events + from happening if serving a static file 0.001001 - 12 Aug 2008 - Initital public release diff --git a/lib/Reaction/UI/Window.pm b/lib/Reaction/UI/Window.pm index 2865e0e..5eda757 100644 --- a/lib/Reaction/UI/Window.pm +++ b/lib/Reaction/UI/Window.pm @@ -27,6 +27,11 @@ sub _build_view { }; sub flush { my ($self) = @_; + my $res = $self->ctx->res; + if ( $res->status =~ /^3/ || length($res->body) ) { + $res->content_type('text/plain') unless $res->content_type; + return; + } $self->flush_events; $self->flush_view; }; @@ -53,10 +58,6 @@ sub flush_events { sub flush_view { my ($self) = @_; my $res = $self->ctx->res; - if ( $res->status =~ /^3/ || length($res->body) ) { - $res->content_type('text/plain') unless $res->content_type; - return; - } $res->body($self->view->render_window($self)); $res->content_type($self->content_type); }; |