[Jifty-commit] r1713 - in jifty/trunk/lib/Jifty/Web: Form

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Mon Jul 31 14:45:19 EDT 2006


Author: nelhage
Date: Mon Jul 31 14:45:19 2006
New Revision: 1713

Modified:
   jifty/trunk/lib/Jifty/Web/Form.pm
   jifty/trunk/lib/Jifty/Web/Form/Clickable.pm

Log:
Jifty::Web::state_variables no longer prefixes keys with J:V- before
returning them, and Clickables now serialize the *outgoing* state
vars, instead of the previous request's.

Modified: jifty/trunk/lib/Jifty/Web/Form.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/Form.pm	Mon Jul 31 14:45:19 2006
@@ -273,7 +273,7 @@
     my %vars = Jifty->web->state_variables;
     for (keys %vars) {
         Jifty->web->out( qq{<input type="hidden" name="}
-                . $_
+                . 'J:V-' . $_
                 . qq{" value="}
                 . $vars{$_}
                 . qq{" />\n} );

Modified: jifty/trunk/lib/Jifty/Web/Form/Clickable.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Clickable.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/Form/Clickable.pm	Mon Jul 31 14:45:19 2006
@@ -173,13 +173,14 @@
     # Anything doing fragment replacement needs to preserve the
     # current state as well
     if ( grep { $self->$_ } $self->handlers or $self->preserve_state ) {
-        for ( Jifty->web->request->state_variables ) {
-            if ( $_->key =~ /^region-(.*?)\.(.*)$/ ) {
-                $self->region_argument( $1, $2 => $_->value );
-            } elsif ( $_->key =~ /^region-(.*)$/ ) {
-                $self->region_fragment( $1, $_->value );
+        my %state_vars = Jifty->web->state_variables;
+        while ( my ($key,  $val) = each %state_vars ) {
+            if ( $key =~ /^region-(.*?)\.(.*)$/ ) {
+                $self->region_argument( $1, $2 => $val );
+            } elsif ( $key =~ /^region-(.*)$/ ) {
+                $self->region_fragment( $1, $val );
             } else {
-                $self->state_variable( $_->key => $_->value );
+                $self->state_variable( $key => $val );
             }
         }
     }


More information about the Jifty-commit mailing list