]> git.imager.perl.org - bse.git/commitdiff
correct the dynamic iterator generator to properly process filters on
authorTony Cook <tony@develop-help.com>
Fri, 21 May 2010 09:27:07 +0000 (09:27 +0000)
committertony <tony@45cb6cf1-00bc-42d2-bb5a-07f51df49f94>
Fri, 21 May 2010 09:27:07 +0000 (09:27 +0000)
conditionals

site/cgi-bin/modules/BSE/Util/DynamicTags.pm
t/t20gen.t

index 05c0a2c387e63853b8b318db8f7a557f2808e191..0cd27b9b8f01316ef87bffa7e6d8341bb97242e8 100644 (file)
@@ -533,8 +533,9 @@ sub _dyn_count {
   my ($self, $rdata, $rindex, $plural, $context, $args, $acts, $name, 
       $templater) = @_;
 
+  my $filter = $self->_get_filter(\$args);
   my $method = "iter_$plural";
-  my $data = $self->$method($context, $args, $acts, $templater);
+  my $data = $self->_do_filter($filter, $self->$method($context, $args, $acts, $templater));
 
   return scalar @$data;
 }
index 863f4a09ab0741b4dbc53f706b4de4407bcdf687..afb551b9b7ffb787dab4a36203961fa1f647b167 100644 (file)
@@ -1,7 +1,7 @@
 #!perl -w
 use strict;
 use BSE::Test ();
-use Test::More tests=>129;
+use Test::More tests=>132;
 use File::Spec;
 use FindBin;
 my $cgidir = File::Spec->catdir(BSE::Test::base_dir, 'cgi-bin');
@@ -448,6 +448,23 @@ One
 
 EXPECTED
 
+dyn_template_test "dynallkidsof nested filtered cond", $parent, <<TEMPLATE, <<EXPECTED;
+<:iterator begin dynallkids_of $parent->{id}:><:dynofallkid title:><:if Dynallkids_of2 dynofallkid filter: [title] =~ /G/:><:iterator begin dynallkids_of2 dynofallkid filter: [title] =~ /G/:>
+  <:dynofallkid2 title:><:iterator end dynallkids_of2:><:or Dynallkids_of2:>
+  No G kids<:eif Dynallkids_of2:>
+<:iterator end dynallkids_of:>
+TEMPLATE
+Parent
+  No G kids
+Three
+  No G kids
+Two
+  Grandkid
+One
+  No G kids
+
+EXPECTED
+
 ############################################################
 # Cleanup