diff Lib/IMPL/Web/Handler/TTView.pm @ 291:5d14baa35790

*TTView: fixed template selectors mechanism
author cin
date Thu, 21 Feb 2013 03:44:02 +0400
parents 546957c50a36
children 71221d79e6b4
line wrap: on
line diff
--- a/Lib/IMPL/Web/Handler/TTView.pm	Wed Feb 20 17:24:57 2013 +0400
+++ b/Lib/IMPL/Web/Handler/TTView.pm	Thu Feb 21 03:44:02 2013 +0400
@@ -1,6 +1,7 @@
 package IMPL::Web::Handler::TTView;
 use strict;
 
+use Carp qw(carp);
 use List::Util qw(first);
 use IMPL::lang;
 use IMPL::Const qw(:prop);
@@ -55,6 +56,15 @@
         env         => _cached($action->context->{environment}),
         ImportClass => sub {
             my $class = shift;
+            
+            carp "ImportClass is obsolete use import instead";
+            
+            $class = Loader->safe->Require($class);
+            
+            return Factory->new($class);
+        },
+        import      => sub {
+            my $class = shift;
 
             $class = Loader->safe->Require($class);
             
@@ -168,6 +178,9 @@
             my @selector = @{$rule->{selector}};
             
             my $part = shift @selector;
+            
+            # if this rule doesn't have a selector
+            next unless $part;
 
             if ($part->{any}) {
                 #keep the rule for the next try
@@ -176,9 +189,6 @@
                 $part = shift @selector while $part->{any};
             }
             
-            # if this rule doesn't have a selector
-            next unless $part;
-            
             my $newRule = {
                 selector => \@selector,
                 data => $rule->{data},