[Jifty-commit] r2642 - jifty/trunk/lib/Jifty/Web

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sat Jan 27 01:58:42 EST 2007


Author: audreyt
Date: Sat Jan 27 01:58:42 2007
New Revision: 2642

Modified:
   jifty/trunk/lib/Jifty/Web/PageRegion.pm

Log:
* PageRegion should be initialized with all state variables from its
  upper level request, not only the ones that concerns itself.
  This fixes t/TestApp/t/13-page-regions.t.


Modified: jifty/trunk/lib/Jifty/Web/PageRegion.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/PageRegion.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/PageRegion.pm	Sat Jan 27 01:58:42 2007
@@ -190,17 +190,19 @@
     push @{Jifty->web->{'region_stack'}}, $self;
 
     # Merge in the settings passed in via state variables
-    for (Jifty->web->request->state_variables) {
-        my $key = $_->key;
-        my $value = $_->value || '';
-        if ($key =~ /^region-(.*?)\.(.*)/ and $1 eq $self->qualified_name and $value  ne $self->default_argument($2)) {
+    for my $var (Jifty->web->request->state_variables) {
+        my $key = $var->key;
+        my $value = $var->value || '';
+
+        if ($key =~ /^region-(.*?)\.(.*)/ and $1 eq $self->qualified_name and $value ne $self->default_argument($2)) {
             $self->argument($2 => $value);
-            Jifty->web->set_variable("region-$1.$2" => $value);
         }
-        if ($key =~ /^region-(.*?)$/ and $1 eq $self->qualified_name and $value ne $self->default_path) {
+        if ($key =~ /^region-(.*)$/ and $1 eq $self->qualified_name and $value ne $self->default_path) {
             $self->path($value);
-            Jifty->web->set_variable("region-$1" => $value);
         }
+
+        # We should always inherit the state variables from the uplevel request.
+        Jifty->web->set_variable($key => $value);
     }
 }
 


More information about the Jifty-commit mailing list