summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2013-01-10 21:41:25 +0100
committerDave Lawrence <dlawrence@mozilla.com>2013-01-10 21:41:25 +0100
commit9b522fc71aa6660979198a3fda3c666c71f6d96d (patch)
treed946464f05ced18bec0588cdb3b7083f97addf52 /Bugzilla
parent5c5d1c59f0a0d16032662e9d61a7c859715efb18 (diff)
downloadbugzilla-9b522fc71aa6660979198a3fda3c666c71f6d96d.tar.gz
bugzilla-9b522fc71aa6660979198a3fda3c666c71f6d96d.tar.xz
Bug 825718: Fix Bugzilla::Bug->check() wrt caching mechanism
r=LpSolit, r=LpSolit - Also fixes the webservices automated tests
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Bug.pm18
1 files changed, 11 insertions, 7 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 13387ae80..779ba59ab 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -383,18 +383,22 @@ sub cache_key {
sub check {
my $class = shift;
- my ($id, $field) = @_;
-
- ThrowUserError('improper_bug_id_field_value', { field => $field }) unless defined $id;
+ my ($param, $field) = @_;
# Bugzilla::Bug throws lots of special errors, so we don't call
# SUPER::check, we just call our new and do our own checks.
- my $self = $class->new(trim($id));
- # For error messages, use the id that was returned by new(), because
- # it's cleaned up.
- $id = $self->id;
+ my $id = ref($param)
+ ? ($param->{id} = trim($param->{id}))
+ : ($param = trim($param));
+ ThrowUserError('improper_bug_id_field_value', { field => $field }) unless defined $id;
+
+ my $self = $class->new($param);
if ($self->{error}) {
+ # For error messages, use the id that was returned by new(), because
+ # it's cleaned up.
+ $id = $self->id;
+
if ($self->{error} eq 'NotFound') {
ThrowUserError("bug_id_does_not_exist", { bug_id => $id });
}