Bug 64428 - Fix webservice errors and tests
git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@779 6955db30-a419-402b-8a0d-67ecbb4d7f56custis
parent
9ec24405b5
commit
4c29489e79
|
@ -102,7 +102,8 @@ sub _throw_error
|
|||
|
||||
# If we are within an eval(), do not do anything more
|
||||
# as we are eval'uating some test on purpose.
|
||||
if ($mode == ERROR_MODE_DIE || _in_eval())
|
||||
if ($mode == ERROR_MODE_DIE ||
|
||||
$mode != ERROR_MODE_DIE_SOAP_FAULT && $mode != ERROR_MODE_JSON_RPC && _in_eval())
|
||||
{
|
||||
die bless { message => ($msg ||= _error_message($type, $error, $vars)), type => $type, error => $error, vars => $vars };
|
||||
}
|
||||
|
@ -177,7 +178,7 @@ sub _throw_error
|
|||
$code = ERROR_UNKNOWN_TRANSIENT if $type eq 'user';
|
||||
}
|
||||
if ($mode == ERROR_MODE_DIE_SOAP_FAULT) {
|
||||
die bless { message => SOAP::Fault->faultcode($code)->faultstring($message) };
|
||||
die SOAP::Fault->faultcode($code)->faultstring($message);
|
||||
}
|
||||
else {
|
||||
my $server = Bugzilla->_json_server;
|
||||
|
@ -193,7 +194,7 @@ sub _throw_error
|
|||
# we die with no message. JSON::RPC checks raise_error before
|
||||
# it checks $@, so it returns the proper error.
|
||||
die if _in_eval();
|
||||
#$server->response($server->error_response_header); # FIXME VERY UGLY HACK
|
||||
$server->response($server->error_response_header);
|
||||
}
|
||||
}
|
||||
elsif ($mode == ERROR_MODE_AJAX)
|
||||
|
|
|
@ -95,7 +95,7 @@ sub fields {
|
|||
foreach my $field (@fields) {
|
||||
my $visibility_field = $field->visibility_field
|
||||
? $field->visibility_field->name : undef;
|
||||
my $vis_value = $field->visibility_value;
|
||||
my $vis_values = $field->visibility_values;
|
||||
my $value_field = $field->value_field
|
||||
? $field->value_field->name : undef;
|
||||
|
||||
|
@ -119,10 +119,7 @@ sub fields {
|
|||
display_name => $self->type('string', $field->description),
|
||||
is_on_bug_entry => $self->type('boolean', $field->enter_bug),
|
||||
visibility_field => $self->type('string', $visibility_field),
|
||||
visibility_values => [
|
||||
defined $vis_value ? $self->type('string', $vis_value->name)
|
||||
: ()
|
||||
],
|
||||
visibility_values => [ map { $self->type('string', $_->name) } @{ $vis_values || [] } ],
|
||||
);
|
||||
if ($has_values) {
|
||||
$field_data{value_field} = $self->type('string', $value_field);
|
||||
|
@ -197,14 +194,11 @@ sub _legal_field_values {
|
|||
else {
|
||||
my @values = Bugzilla::Field::Choice->type($field)->get_all();
|
||||
foreach my $value (@values) {
|
||||
my $vis_val = $value->visibility_value;
|
||||
my $vis_values = $value->visibility_values;
|
||||
push(@result, {
|
||||
name => $self->type('string', $value->name),
|
||||
sortkey => $self->type('int' , $value->sortkey),
|
||||
visibility_values => [
|
||||
defined $vis_val ? $self->type('string', $vis_val->name)
|
||||
: ()
|
||||
],
|
||||
visibility_values => [ map { $self->type('string', $_->name) } @{ $vis_values || [] } ],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,10 +42,14 @@ sub create_json_coder {
|
|||
my $json = $self->SUPER::create_json_coder(@_);
|
||||
$json->allow_blessed(1);
|
||||
$json->convert_blessed(1);
|
||||
# This may seem a little backwards, but what this really means is
|
||||
# "don't convert our utf8 into byte strings, just leave it as a
|
||||
# utf8 string."
|
||||
$json->utf8(0) if Bugzilla->params->{'utf8'};
|
||||
#*********************************************************************#
|
||||
# ïÒÉÇÉÎÁÌØÎÏÅ ÒÅÛÅÎÉÅ, ÎÏ ÐÒÉ×ÏÄÉÔ Ë ÏÛÉÂËÁÍ #
|
||||
# JSON::RPC::Server at line 170 (HTTP::Message content must be bytes) #
|
||||
## This may seem a little backwards, but what this really means is #
|
||||
## "don't convert our utf8 into byte strings, just leave it as a #
|
||||
## utf8 string." #
|
||||
#$json->utf8(0) if Bugzilla->params->{'utf8'}; #
|
||||
#*********************************************************************#
|
||||
return $json;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,5 +40,4 @@ Bugzilla->error_mode(ERROR_MODE_JSON_RPC);
|
|||
local @INC = (bz_locations()->{extensionsdir}, @INC);
|
||||
my $server = new Bugzilla::WebService::Server::JSONRPC;
|
||||
|
||||
$Bugzilla::Error::IN_EVAL++;
|
||||
$server->dispatch(WS_DISPATCH)->handle();
|
||||
|
|
|
@ -60,15 +60,15 @@ use constant GLOBAL_GENERAL_FIELDS => qw(
|
|||
work_time
|
||||
);
|
||||
use constant STANDARD_SELECT_FIELDS =>
|
||||
qw(bug_severity bug_status op_sys priority rep_platform resolution);
|
||||
qw(bug_severity bug_status priority resolution);
|
||||
|
||||
use constant ALL_SELECT_FIELDS => (STANDARD_SELECT_FIELDS,
|
||||
qw(cf_qa_status cf_single_select));
|
||||
use constant ALL_SELECT_FIELDS => (STANDARD_SELECT_FIELDS);
|
||||
# qw(cf_qa_status cf_single_select));
|
||||
use constant PRODUCT_FIELDS => qw(version target_milestone component);
|
||||
use constant ALL_FIELDS => (GLOBAL_GENERAL_FIELDS, ALL_SELECT_FIELDS,
|
||||
PRODUCT_FIELDS);
|
||||
|
||||
use constant PUBLIC_PRODUCT => 'Another Product';
|
||||
use constant PUBLIC_PRODUCT => 'PublicProduct';
|
||||
use constant PRIVATE_PRODUCT => 'QA-Selenium-TEST';
|
||||
|
||||
sub get_field {
|
||||
|
|
Loading…
Reference in New Issue