pull values from form to config
authorJoey Hess <joey@kodama.kitenet.net>
Sun, 3 Aug 2008 03:14:59 +0000 (23:14 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Sun, 3 Aug 2008 03:14:59 +0000 (23:14 -0400)
IkiWiki/Plugin/websetup.pm

index 64c4d09917dc445bb0432fa76f3ed61e0363f7f2..24ccee40f09e634e77fee99d9da5015cd080299d 100644 (file)
@@ -261,7 +261,16 @@ sub showform ($$) { #{{{
                foreach my $field (keys %fields) {
                        # TODO plugin enable/disable
                        next if $field=~/^enable\./; # plugin
-                       $config{$fields{$field}}=$form->field($field);
+
+                       my $key=$fields{$field};
+                       my $value=$form->field($field);
+
+                       next unless defined $value;
+                       # Avoid setting fields to empty strings,
+                       # if they were not set before.
+                       next if ! defined $config{$key} && ! length $value;
+
+                       $config{$key}=$value;
                }
                # TODO save to real path
                IkiWiki::Setup::dump("/tmp/s");