[Jifty-commit] r7520 - in Template-Declare/branches/mixmaster: t

Jifty commits jifty-commit at lists.jifty.org
Wed Oct 7 14:54:25 EDT 2009


Author: theory
Date: Wed Oct  7 14:54:24 2009
New Revision: 7520

Modified:
   Template-Declare/branches/mixmaster/lib/Template/Declare.pm
   Template-Declare/branches/mixmaster/t/aliasing.t

Log:
Change the invocant in templates `alias`ed aliased via subclasses but defined
in a parent of that subclass so that it is the class in which it was defined,
rather than the subclass. This makes `alias` consistent with
`import_templates`.



Modified: Template-Declare/branches/mixmaster/lib/Template/Declare.pm
==============================================================================
--- Template-Declare/branches/mixmaster/lib/Template/Declare.pm	(original)
+++ Template-Declare/branches/mixmaster/lib/Template/Declare.pm	Wed Oct  7 14:54:24 2009
@@ -642,12 +642,12 @@
     foreach my $import_from (@packages) {
         foreach my $template_name (  __PACKAGE__->_templates_for($import_from) ) {
             my $code = $import_from->_find_template_sub( _template_name_to_sub($template_name));
-            $code = _code( $code, $import_from_base, $package_vars) if $is_alias;
+            $code = _code( $code, $import_from, $package_vars) if $is_alias;
             $import_into->register_template( $prepend_path . "/" . $template_name, $code);
         }
         foreach my $template_name (  __PACKAGE__->_private_templates_for($import_from) ) {
             my $code = $import_from->_find_template_sub( _template_name_to_private_sub($template_name) );
-            $code = _code( $code, $import_from_base, $package_vars) if $is_alias;
+            $code = _code( $code, $import_from, $package_vars) if $is_alias;
             $import_into->register_private_template( $prepend_path . "/" . $template_name, $code);
         }
     }
@@ -655,7 +655,7 @@
 
 sub _code {
     my ($code, $class, $vars) = @_;
-#    return $code unless $vars;
+    return $code unless $vars;
     return sub {
         # XXX This does not seem to be needed.
         # shift @_;  # Get rid of the passed-in "$self" class.

Modified: Template-Declare/branches/mixmaster/t/aliasing.t
==============================================================================
--- Template-Declare/branches/mixmaster/t/aliasing.t	(original)
+++ Template-Declare/branches/mixmaster/t/aliasing.t	Wed Oct  7 14:54:24 2009
@@ -91,7 +91,7 @@
     );
     like(
         $simple,
-        qr{'Wifty::UI::aliased_subclass_pkg'},
+        qr{'Wifty::UI::aliased_pkg'},
         '$self is correct in template block'
     );
     ok_lint($simple);


More information about the Jifty-commit mailing list