diff options
author | lpsolit%gmail.com <> | 2005-07-20 11:14:24 +0200 |
---|---|---|
committer | lpsolit%gmail.com <> | 2005-07-20 11:14:24 +0200 |
commit | 5f9f484fadbdc28be6b0c6b9ab0b67b6fd4d0e9c (patch) | |
tree | 2a298cf1e8bf260063bf40368a179a0cb3ede63a /Bugzilla | |
parent | 82787bc9132869edb068904dfc8123414c115639 (diff) | |
download | bugzilla-5f9f484fadbdc28be6b0c6b9ab0b67b6fd4d0e9c.tar.gz bugzilla-5f9f484fadbdc28be6b0c6b9ab0b67b6fd4d0e9c.tar.xz |
Bug 257767: Option to have fields in CSV files separated by semicolons instead of commas - Patch by Marc Schumann <wurblzap@gmail.com> r=LpSolit a=myk
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/User/Setting.pm | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Bugzilla/User/Setting.pm b/Bugzilla/User/Setting.pm index df1ba28f8..a5ce9411f 100644 --- a/Bugzilla/User/Setting.pm +++ b/Bugzilla/User/Setting.pm @@ -27,6 +27,7 @@ use base qw(Exporter); add_setting); use Bugzilla::Error; +use Bugzilla::Util qw{trick_taint}; ############################### ### Module Initialization ### @@ -224,6 +225,19 @@ sub legal_values { return $self->{'legal_values'}; } +sub validate_value { + my $self = shift; + + if (grep(/^$_[0]$/, @{$self->legal_values()})) { + trick_taint($_[0]); + } + else { + ThrowCodeError('setting_value_invalid', + {'name' => $self->{'_setting_name'}, + 'value' => $_[0]}); + } +} + sub reset_to_default { my ($self) = @_; @@ -346,6 +360,15 @@ Description: Returns all legal values for this setting Params: none Returns: A reference to an array containing all legal values +=item C<validate_value> + +Description: Determines whether a value is valid for the setting + by checking against the list of legal values. + Untaints the parameter if the value is indeed valid, + and throws a setting_value_invalid code error if not. +Params: An lvalue containing a candidate for a setting value +Returns: nothing + =item C<reset_to_default> Description: If a user chooses to use the global default for a given |