From a86ee3a1ca5213d5401c6425cfb0fcfc7bb15e78 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Tue, 31 Mar 2009 06:37:53 +0000 Subject: Bug 432907: Create a JSON frontend for WebServices Patch by Max Kanat-Alexander r=dkl, a=mkanat --- Bugzilla.pm | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'Bugzilla.pm') diff --git a/Bugzilla.pm b/Bugzilla.pm index 324b3cc14..7bd40794a 100644 --- a/Bugzilla.pm +++ b/Bugzilla.pm @@ -360,6 +360,15 @@ sub error_mode { || (i_am_cgi() ? ERROR_MODE_WEBPAGE : ERROR_MODE_DIE); } +# This is used only by Bugzilla::Error to throw errors. +sub _json_server { + my ($class, $newval) = @_; + if (defined $newval) { + $class->request_cache->{_json_server} = $newval; + } + return $class->request_cache->{_json_server}; +} + sub usage_mode { my ($class, $newval) = @_; if (defined $newval) { @@ -369,9 +378,12 @@ sub usage_mode { elsif ($newval == USAGE_MODE_CMDLINE) { $class->error_mode(ERROR_MODE_DIE); } - elsif ($newval == USAGE_MODE_WEBSERVICE) { + elsif ($newval == USAGE_MODE_XMLRPC) { $class->error_mode(ERROR_MODE_DIE_SOAP_FAULT); } + elsif ($newval == USAGE_MODE_JSON) { + $class->error_mode(ERROR_MODE_JSON_RPC); + } elsif ($newval == USAGE_MODE_EMAIL) { $class->error_mode(ERROR_MODE_DIE); } @@ -667,10 +679,11 @@ usage mode changes. =item C Call either Cusage_mode(Bugzilla::Constants::USAGE_MODE_CMDLINE)> -or Cusage_mode(Bugzilla::Constants::USAGE_MODE_WEBSERVICE)> near the +or Cusage_mode(Bugzilla::Constants::USAGE_MODE_XMLRPC)> near the beginning of your script to change this flag's default of C and to indicate that Bugzilla is being called in a non-interactive manner. + This influences error handling because on usage mode changes, C calls Cerror_mode> to set an error mode which makes sense for the usage mode. -- cgit v1.2.3-24-g4f1b