[Jifty-commit] r1380 - in jifty: trunk/lib/Jifty

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Wed Jun 28 12:09:59 EDT 2006


Author: nelhage
Date: Wed Jun 28 12:09:56 2006
New Revision: 1380

Modified:
   jifty/   (props changed)
   jifty/trunk/lib/Jifty/Web.pm

Log:
 r13213 at phanatique:  nelhage | 2006-06-27 17:45:27 +0200
 Expanding state variable management slightly


Modified: jifty/trunk/lib/Jifty/Web.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web.pm	(original)
+++ jifty/trunk/lib/Jifty/Web.pm	Wed Jun 28 12:09:56 2006
@@ -1115,6 +1115,8 @@
 form that is marked as 'state preserving'.  See
 L<Jifty::Web::Form::Clickable>.
 
+Passing C<undef> as a value will remove the variable
+
 =cut
 
 sub set_variable {
@@ -1122,7 +1124,11 @@
     my $name  = shift;
     my $value = shift;
 
-    $self->{'state_variables'}->{$name} = $value;
+    if (!defined($value)) {
+        delete $self->{'state_variables'}->{$name};
+    } else {
+        $self->{'state_variables'}->{$name} = $value;
+    }
 
 }
 
@@ -1144,6 +1150,18 @@
     return %vars;
 }
 
+=head3 clear_state_variables
+
+Remove all the state variables to be serialized for the next request.
+
+=cut
+
+sub clear_state_variables {
+    my $self = shift;
+
+    $self->{'state_variables'} = {};
+}
+
 =head2 REGIONS
 
 =head3 get_region [QUALIFIED NAME]


More information about the Jifty-commit mailing list