[Rt-commit] r14563 - in rt/branches/3.999-DANGEROUS: lib/RT

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Jul 28 02:14:13 EDT 2008


Author: sunnavy
Date: Mon Jul 28 02:14:11 2008
New Revision: 14563

Modified:
   rt/branches/3.999-DANGEROUS/   (props changed)
   rt/branches/3.999-DANGEROUS/lib/RT/Config.pm

Log:
 r15050 at sunnavys-mb:  sunnavy | 2008-07-28 14:13:29 +0800
 allow other name conventions(e.g. date_time_format) in config, though we default it to be UpperCamelCase


Modified: rt/branches/3.999-DANGEROUS/lib/RT/Config.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Config.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Config.pm	Mon Jul 28 02:14:11 2008
@@ -50,6 +50,7 @@
 
 package RT::Config;
 use File::Spec ();
+use Text::Naming::Convention qw/renaming/;
 
 =head1 name
 
@@ -512,6 +513,11 @@
 sub get {
     my ( $self, $name, $user ) = @_;
 
+    if ( $name ne 'rtname' && $name !~ /[A-Z]/ ) {
+        # we need to rename it to be UpperCamelCase
+        $name = renaming( $name, { convention => 'UpperCamelCase' } );
+    }
+
     my $res;
     if ( $user && $user->id && $META{$name}->{'overridable'} ) {
         $user = $user->user_object if $user->isa('RT::CurrentUser');
@@ -537,6 +543,11 @@
 sub set {
     my ( $self, $name ) = ( shift, shift );
 
+    if ( $name ne 'rtname' && $name !~ /[A-Z]/ ) {
+        # we need to rename it to be UpperCamelCase
+        $name = renaming( $name, { convention => 'UpperCamelCase' } );
+    }
+
     my $old = $OPTIONS{$name};
     my $type = $META{$name}->{'type'} || 'SCALAR';
     if ( $type eq 'ARRAY' ) {


More information about the Rt-commit mailing list