[Rt-commit] r19373 - rt/3.999/branches/config-in-db/lib/RT/Action

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Apr 30 03:21:04 EDT 2009


Author: sunnavy
Date: Thu Apr 30 03:21:04 2009
New Revision: 19373

Modified:
   rt/3.999/branches/config-in-db/lib/RT/Action/ConfigSystem.pm

Log:
improve config system action

Modified: rt/3.999/branches/config-in-db/lib/RT/Action/ConfigSystem.pm
==============================================================================
--- rt/3.999/branches/config-in-db/lib/RT/Action/ConfigSystem.pm	(original)
+++ rt/3.999/branches/config-in-db/lib/RT/Action/ConfigSystem.pm	Thu Apr 30 03:21:04 2009
@@ -91,15 +91,28 @@
 sub take_action {
     my $self = shift;
 
-            Jifty->log->error( 'ok' );
     for my $arg ( $self->argument_names ) {
         if ( $self->has_argument($arg) ) {
             my $value = $self->argument_value( $arg );
-            if ( $value =~ /^\[\s*(.*)\s*$\]/ ) {
-                $value = [ split /\s*,\s*/, $1 ];
-            }
-            elsif ( $value =~ /^{\s*(.*)\s*$}/ ) {
-                $value = { split /\s*(?:,|=>)\s*/, $1 };
+            if ($value && $value !~ /^{{\w+}}/ ) {
+                if ( $value =~ /^\[ \s* (.*?) \s* \]\s*$/x ) {
+                    my $v = $1;
+                    if ($v =~ /\S/ ) {
+                        $value = [ split /\s*,\s*/, $v ];
+                    }
+                    else {
+                        $value = [];
+                    }
+                }
+                elsif ( $value =~ /^{ \s* (.*?) \s* } \s* $/x ) {
+                    my $pair = $1;
+                    if ( $pair =~ /\S/ ) {
+                        $value = { split /\s*(?:,|=>)\s*/, $pair };
+                    }
+                    else {
+                        $value = {};
+                    }
+                }
             }
 
             RT->config->set( $arg, $value );


More information about the Rt-commit mailing list