[Jifty-commit] jifty branch, master, updated. 1.10518-80-g16108cd

Jifty commits jifty-commit at lists.jifty.org
Thu Apr 26 12:45:31 EDT 2012


The branch, master has been updated
       via  16108cd535d33dd9ae01506d73555c3ef7b3260f (commit)
       via  bd6e80b24604e9e5f32de40636605cb7eedd2364 (commit)
       via  49a8b0de6261e3c736dddd8d98a045e3a69e4f89 (commit)
       via  97ef65d40e8f5ff3afd12ba4551126d9a96e0ce8 (commit)
       via  1c8d6be70cdb67f95107118a019758d450a38673 (commit)
      from  4f3b3c3de3ea54950cb205b638670a63af6baf0f (commit)

Summary of changes:
 lib/Jifty/Config.pm            |   25 ++++++++++++++-----------
 lib/Jifty/Plugin/Halo.pm       |    7 +++++++
 lib/Jifty/Plugin/Halo/Mason.pm |    1 +
 t/TestApp/t/config-Cachable    |    1 +
 4 files changed, 23 insertions(+), 11 deletions(-)

- Log -----------------------------------------------------------------
commit 1c8d6be70cdb67f95107118a019758d450a38673
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Apr 26 00:42:58 2012 -0400

    Ensure that Template::Declare halos run in the <body>
    
    When 8d11269 removed the mostly-unnecessary "proscribed" abstraction, it
    removed the logic which ensured that Template::Declare halos only ran
    inside of the <body> tag; HTML::Mason halos were unaffected, as they use
    a separate codepath.
    
    Restore the logic that ensures that Template::Declare halos are only
    rendered where it is appropriate.

diff --git a/lib/Jifty/Plugin/Halo.pm b/lib/Jifty/Plugin/Halo.pm
index 7c02192..ba0bf43 100644
--- a/lib/Jifty/Plugin/Halo.pm
+++ b/lib/Jifty/Plugin/Halo.pm
@@ -74,6 +74,9 @@ around the template itself.
 sub around_template {
     my ($self, $orig, $path, $args, $code) = @_;
 
+    return $orig->() if $path eq "/__jifty/halo";
+    return $orig->() unless Jifty->handler->stash->{'in_body'};
+
     # for now, call the last piece of the template's path the name
     $path =~ m{.*/(.+)};
     my $name = $1 || $path;

commit 97ef65d40e8f5ff3afd12ba4551126d9a96e0ce8
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Apr 26 00:46:41 2012 -0400

    Provide backwards compatibility with old HTML::Mason wrapper files
    
    While the new /_elements/wrapper uses callbacks to entensibly provide
    hooks for both halos as well as other plugins, applications which copied
    and customized the /_elements/wrapper file will still have the previous
    code in it.  For backwards compatibility, provide the
    Jifty::View::Mason::Halo::render_component_tree function that such
    components will still reference.

diff --git a/lib/Jifty/Plugin/Halo.pm b/lib/Jifty/Plugin/Halo.pm
index ba0bf43..84b91bb 100644
--- a/lib/Jifty/Plugin/Halo.pm
+++ b/lib/Jifty/Plugin/Halo.pm
@@ -347,4 +347,8 @@ sub render_component_tree {
     return 1;
 }
 
+# Back-compat with old Mason "/_elements/wrapper" files
+package Jifty::View::Mason::Halo;
+*render_component_tree = \&Jifty::Plugin::Halo::render_component_tree;
+
 1;

commit 49a8b0de6261e3c736dddd8d98a045e3a69e4f89
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Apr 26 00:48:53 2012 -0400

    Short-circuit halo close on error
    
    end_component_hook is still called for every component even if the
    request is in the midst of aborting (because of a run-time error, for
    instance).  Detect such cases and short-circuit the closing halo code,
    which would simply be discarded.  Note that $context->error is always a
    scalar ref (either to an empty string, or an exception object), as Mason
    allows the plugin to modify the error.

diff --git a/lib/Jifty/Plugin/Halo/Mason.pm b/lib/Jifty/Plugin/Halo/Mason.pm
index bafad59..56ad1d8 100644
--- a/lib/Jifty/Plugin/Halo/Mason.pm
+++ b/lib/Jifty/Plugin/Halo/Mason.pm
@@ -52,6 +52,7 @@ sub end_component_hook {
     return if ($context->comp->path || '') eq "/__jifty/halo";
     return unless Jifty->handler->stash->{'in_body'};
     return if $context->comp->is_subcomp;
+    return if ${ $context->error };
 
     my $frame = Jifty::Plugin::Halo->pop_frame;
     $context->request->out(Jifty::Plugin::Halo->halo_footer($frame));

commit bd6e80b24604e9e5f32de40636605cb7eedd2364
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Apr 26 01:15:44 2012 -0400

    Explicitly add Halo plugin to a tests which needs it
    
    Previously, DevelMode (which defaults to on) turned on Halos.  As
    t/TestApp expects halos, explcitly enable them.

diff --git a/t/TestApp/t/config-Cachable b/t/TestApp/t/config-Cachable
index 37ab1db..cd83c45 100644
--- a/t/TestApp/t/config-Cachable
+++ b/t/TestApp/t/config-Cachable
@@ -8,3 +8,4 @@ framework:
     - SkeletonApp: {}
     - Compat: {}
     - Deflater: {}
+    - Halo: {}

commit 16108cd535d33dd9ae01506d73555c3ef7b3260f
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Apr 26 01:17:59 2012 -0400

    Reduce repetition in back-compat configuration analysis

diff --git a/lib/Jifty/Config.pm b/lib/Jifty/Config.pm
index 237c07f..37ccf95 100644
--- a/lib/Jifty/Config.pm
+++ b/lib/Jifty/Config.pm
@@ -605,12 +605,15 @@ sub update_config {
     my $self = shift;
     my $config = shift;
 
+    my $version = $config->{'framework'}->{'ConfigFileVersion'};
+    my $plugins = ($config->{'framework'}->{'Plugins'} ||= []);
+
     # This app configuration predates the plugin refactor
-    if ( $config->{'framework'}->{'ConfigFileVersion'} < 2) {
+    if ($version < 2) {
 
         # These are the plugins which old apps expect because their
         # features used to be in the core.
-        unshift (@{$config->{'framework'}->{'Plugins'}}, 
+        unshift (@{$plugins},
             { AdminUI            => {}, },
             { CompressedCSSandJS => {}, },
             { ErrorTemplates     => {}, },
@@ -621,25 +624,25 @@ sub update_config {
         );
     }
 
-    if ( $config->{'framework'}->{'ConfigFileVersion'} < 3) {
-        unshift (@{$config->{'framework'}->{'Plugins'}}, 
+    if ($version < 3) {
+        unshift (@{$plugins},
             { CSSQuery           => {}, }
         );
     }
 
-    if ( $config->{'framework'}->{'ConfigFileVersion'} < 4) {
-        unshift (@{$config->{'framework'}->{'Plugins'}}, 
+    if ($version < 4) {
+        unshift (@{$plugins},
             { Prototypism        => {}, }
         );
     }
 
-    if ( $config->{'framework'}->{'ConfigFileVersion'} < 5) {
-        unshift (@{$config->{'framework'}->{'Plugins'}},
-            { Compat        => {}, }
+    if ($version < 5) {
+        unshift (@{$plugins},
+            { Compat             => {}, }
         );
 
-        push (@{$config->{'framework'}->{'Plugins'}},
-            { Deflater      => {}, }
+        push (@{$plugins},
+            { Deflater           => {}, }
         );
     }
 

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list