[Jifty-commit] r2214 - jifty/branches/template-declare/lib/Jifty/View/Declare

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Wed Nov 29 07:29:36 EST 2006


Author: audreyt
Date: Wed Nov 29 07:29:35 2006
New Revision: 2214

Modified:
   jifty/branches/template-declare/lib/Jifty/View/Declare/Handler.pm

Log:
* Jifty::View::Declare::Handler noise cancellation:
    - Failing to locate the View provider module and falling back to 
      Mason should be a ->debug, not ->error.
    - Failing to locate the page within the View module and falling back to
      Mason should be a ->warning, not ->error.
    - Also cleans up random warnings with symbolic deref.


Modified: jifty/branches/template-declare/lib/Jifty/View/Declare/Handler.pm
==============================================================================
--- jifty/branches/template-declare/lib/Jifty/View/Declare/Handler.pm	(original)
+++ jifty/branches/template-declare/lib/Jifty/View/Declare/Handler.pm	Wed Nov 29 07:29:35 2006
@@ -15,8 +15,13 @@
     my $self = shift;
     my $package = shift;
     my $template = shift;
-        no warnings qw/redefine/;
-        local *{Jifty::Web::out} = sub { shift; my $out = shift; Template::Declare::Tags::outs( $out);};
+
+    no warnings qw/redefine/;
+    local *Jifty::Web::out = sub {
+        shift;  # Remove the $self in Jifty::Web->out
+        goto &Template::Declare::Tags::outs;
+    };
+
     local $Template::Declare::Tags::BUFFER = '';
     print STDOUT $package->show($template);
     return undef;
@@ -52,13 +57,19 @@
     my $template   = pop @components;
 
     my $package =  join('::',$self->root_class,grep { $_ } @components);
-     Jifty::Util->require($package) ;
+    $package->require;
+
+    if ($UNIVERSAL::require::ERROR =~ /^Can't locate/) {
+        $self->log->debug($UNIVERSAL::require::ERROR);
+        return undef;
+    }
+
     unless ( $package->isa('Jifty::View::Declare::Templates') ) {
         $self->log->error( "$package (" . $self->root_class . " / $templatename) isn't a valid template package." );
         return undef;
     }
     unless ( $package->can('has_template') &&  $package->has_template($template) ) {
-        $self->log->error("$package has no template $template.");
+        $self->log->warn("$package has no template $template.");
         return undef;
 
     }


More information about the Jifty-commit mailing list