[Jifty-commit] r7234 - jifty/trunk/lib/Jifty/Plugin/Config/Action

Jifty commits jifty-commit at lists.jifty.org
Thu Jun 11 15:13:12 EDT 2009


Author: sartak
Date: Thu Jun 11 15:13:11 2009
New Revision: 7234

Modified:
   jifty/trunk/lib/Jifty/Plugin/Config/Action/AddConfig.pm

Log:
empty_is_undef option for AddConfig

Modified: jifty/trunk/lib/Jifty/Plugin/Config/Action/AddConfig.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/Config/Action/AddConfig.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/Config/Action/AddConfig.pm	Thu Jun 11 15:13:11 2009
@@ -22,6 +22,10 @@
     param target_file =>
         default is 'etc/site_config.yml',
         type is 'text';
+
+    param empty_is_undef =>
+        default is 0,
+        type is 'bool';
 };
 
 sub contextualize {
@@ -64,7 +68,11 @@
 
     my ($new_config, $pointer) = $self->contextualize($context);
 
-    $self->log->info("Changing config $field (in context $context) to $value");
+    undef $value if $self->argument_value('empty_is_undef') && $value eq '';
+
+    my $display_value = defined($value) ? $value : "(undef)";
+    $self->log->info("Changing config $field (in context $context) to $display_value");
+
     $pointer->{$field} = $value;
 
     $self->write_new_config($new_config);


More information about the Jifty-commit mailing list