[Rt-commit] r19268 - rt/3.999/branches/config-in-db/lib/RT/Model

sunnavy at bestpractical.com sunnavy at bestpractical.com
Fri Apr 17 01:40:39 EDT 2009


Author: sunnavy
Date: Fri Apr 17 01:40:38 2009
New Revision: 19268

Modified:
   rt/3.999/branches/config-in-db/lib/RT/Model/Config.pm

Log:
empty string is treated as undef in Jifty's record, but we don't want this behavior in Model::Config, so hack for it

Modified: rt/3.999/branches/config-in-db/lib/RT/Model/Config.pm
==============================================================================
--- rt/3.999/branches/config-in-db/lib/RT/Model/Config.pm	(original)
+++ rt/3.999/branches/config-in-db/lib/RT/Model/Config.pm	Fri Apr 17 01:40:38 2009
@@ -75,7 +75,9 @@
     my $config = RT::Model::Config->new;
     my ( $ret, $msg ) = $config->load_by_cols( name => $name );
     if ($ret) {
-        return $config->value;
+        my $value = $config->value;
+        return '' if defined $value && $value eq '[empty string]';
+        return $value;
     }
     else {
         return;
@@ -112,6 +114,10 @@
     my $name  = shift;
     my $value = shift;
 
+    if ( defined $value && $value eq '' ) {
+        $value = '[empty string]'; # bloddy hack, or '' will be treated as undef
+    }
+
     my $config = RT::Model::Config->new( current_user => RT->system_user );
     my ( $ret, $msg ) = $config->load_by_cols( name => $name );
     if ($ret) {


More information about the Rt-commit mailing list