[Rt-commit] r7651 - in rt/branches/3.7-EXPERIMENTAL: . bin
lib/RT/I18N lib/t/regression
ruz at bestpractical.com
ruz at bestpractical.com
Mon Apr 23 22:30:42 EDT 2007
Author: ruz
Date: Mon Apr 23 22:30:39 2007
New Revision: 7651
Modified:
rt/branches/3.7-EXPERIMENTAL/ (props changed)
rt/branches/3.7-EXPERIMENTAL/bin/rt.in
rt/branches/3.7-EXPERIMENTAL/lib/RT/Config.pm
rt/branches/3.7-EXPERIMENTAL/lib/RT/I18N/de.po
rt/branches/3.7-EXPERIMENTAL/lib/t/regression/26command_line.t
Log:
merge from 3.7-EXP-RTIR-2.0 into 3.7-EXP
r3259 at cubic-pc: svm | 2006-06-16 19:24:39 +0400
SVM: initializing mirror for /mirrors/branches/3.7-EXPERIMENTAL-RTIR-2.0
r3260 at cubic-pc (orig r5352): jesse | 2006-06-08 23:43:51 +0400
r3309 at cubic-pc (orig r5469): ruz | 2006-06-27 03:12:48 +0400
* return old value on Set, so we could write:
my @old_val = RT->Config->Set( Option => @tmp_val );
...
RT->Config->Set( Option => @old_val );
r3894 at cubic-pc (orig r6057): ruz | 2006-09-27 09:00:01 +0400
merge latest changes from 3.5 branch
r3749 at cubic-pc (orig r5308): jesse | 2006-05-26 21:33:55 +0400
r9855 at jesse-vincents-computer-2: jesse | 2006-05-26 13:33:19 -0400
*RC3
r3750 at cubic-pc (orig r5316): jesse | 2006-05-30 02:38:53 +0400
r9889 at pinglin: jesse | 2006-05-29 18:37:55 -0400
* The german translation had been corrupted
r3751 at cubic-pc (orig r5337): kevinr | 2006-06-05 23:41:08 +0400
r13079 at sad-girl-in-snow: kevinr | 2006-06-05 15:23:21 -0400
* Updated the CLI test suite so it doesn't depend on any other tests running
before it.
r3752 at cubic-pc (orig r5338): kevinr | 2006-06-05 23:41:19 +0400
r13080 at sad-girl-in-snow: kevinr | 2006-06-05 15:40:36 -0400
* Added docs for 'rt <take|untake|steal>'
* Some small doc clean-up
r3753 at cubic-pc (orig r5361): jesse | 2006-06-15 02:34:59 +0400
r12610 at pinglin: jesse | 2006-06-15 00:33:56 +0200
* Bumping for 3.6.0 release
Modified: rt/branches/3.7-EXPERIMENTAL/bin/rt.in
==============================================================================
Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Config.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Config.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Config.pm Mon Apr 23 22:30:39 2007
@@ -316,17 +316,8 @@
=cut
-sub Get
-{
- my $self = shift;
- my $name = shift;
- my $user = shift;
- unless ( exists $OPTIONS{ $name } ) {
- # if don't know anything about option
- # return empty list, but undef in scalar
- # context
- return wantarray? (): undef;
- }
+sub Get {
+ my ($self, $name, $user) = @_;
my $res;
if ( $user && $META{ $name }->{'Overridable'} ) {
@@ -335,20 +326,13 @@
$res = $prefs->{ $name } if $prefs;
}
$res = $OPTIONS{ $name } unless defined $res;
- return $res unless wantarray;
-
- my $type = $META{ $name }->{'Type'} || 'SCALAR';
- if( $type eq 'ARRAY' ) {
- return @{ $res };
- } elsif( $type eq 'HASH' ) {
- return %{ $res };
- }
- return $res;
+ return $self->_ReturnValue($res, $META{ $name }->{'Type'} || 'SCALAR');
}
=head2 Set
Set option's value to new value. Takes name of the option and new value.
+Returns old value.
The new value should scalar, array or hash depending on type of the option.
If the option is not defined in meta or the default RT config then it is of
@@ -356,16 +340,15 @@
=cut
-sub Set
-{
- my $self = shift;
- my $name = shift;
-
- my $type = $META{$name}->{'Type'} || 'SCALAR';
- if( $type eq 'ARRAY' ) {
+sub Set {
+ my ($self, $name) = (shift, shift);
+
+ my $old = $OPTIONS{ $name };
+ my $type = $META{ $name }->{'Type'} || 'SCALAR';
+ if ( $type eq 'ARRAY' ) {
$OPTIONS{$name} = [ @_ ];
{ no strict 'refs'; @{"RT::$name"} = (@_); }
- } elsif( $type eq 'HASH' ) {
+ } elsif ( $type eq 'HASH' ) {
$OPTIONS{$name} = { @_ };
{ no strict 'refs'; %{"RT::$name"} = (@_); }
} else {
@@ -373,9 +356,19 @@
{ no strict 'refs'; ${"RT::$name"} = $OPTIONS{$name}; }
}
$META{$name}->{'Type'} = $type;
+ return $self->_ReturnValue($old, $type);
+}
+sub _ReturnValue {
+ my ($self, $res, $type) = @_;
+ return $res unless wantarray;
- return 1;
+ if( $type eq 'ARRAY' ) {
+ return @{ $res };
+ } elsif( $type eq 'HASH' ) {
+ return %{ $res };
+ }
+ return $res;
}
sub SetFromConfig
Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/I18N/de.po
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/I18N/de.po (original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/I18N/de.po Mon Apr 23 22:30:39 2007
@@ -4152,7 +4152,7 @@
#: html/Widgets/SelectionBox:209
msgid "Selections modified. Please save your changes"
-msgstr "Auswahl wurde geändert. Bitte speichere Deine Ãnderungen"
+msgstr "Auswahl wurde geändert. Bitte speichere Deine Änderungen"
#: etc/initialdata:121
msgid "Send mail to all watchers"
Modified: rt/branches/3.7-EXPERIMENTAL/lib/t/regression/26command_line.t
==============================================================================
More information about the Rt-commit
mailing list