]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 724464 - JSON-RPC support shouldn't require SOAP::Lite
authorDave Lawrence <dlawrence@mozilla.com>
Wed, 15 Feb 2012 16:02:52 +0000 (11:02 -0500)
committerDave Lawrence <dlawrence@mozilla.com>
Wed, 15 Feb 2012 16:02:52 +0000 (11:02 -0500)
r/a=LpSolit

Bugzilla/WebService.pm
Bugzilla/WebService/Server/XMLRPC.pm

index c428e10ecbf34ae6efd1bde429a257ce85760c42..88ffa3f9612bb65e8533e9e25324583aeb12c1b5 100644 (file)
@@ -11,8 +11,6 @@ package Bugzilla::WebService;
 use strict;
 use Bugzilla::WebService::Server;
 
-use XMLRPC::Lite;
-
 # Used by the JSON-RPC server to convert incoming date fields apprpriately.
 use constant DATE_FIELDS => {};
 # Used by the JSON-RPC server to convert incoming base64 fields appropriately.
@@ -30,24 +28,6 @@ sub login_exempt {
     return $class->LOGIN_EXEMPT->{$method};
 }
 
-sub type {
-    my ($self, $type, $value) = @_;
-    if ($type eq 'dateTime') {
-        $value = $self->datetime_format_outbound($value);
-    }
-    return XMLRPC::Data->type($type)->value($value);
-}
-
-# This is the XML-RPC implementation, see the README in Bugzilla/WebService/.
-# Our "base" implementation is in Bugzilla::WebService::Server.
-sub datetime_format_outbound {
-    my $self = shift;
-    my $value = Bugzilla::WebService::Server->datetime_format_outbound(@_);
-    # XML-RPC uses an ISO-8601 format that doesn't have any hyphens.
-    $value =~ s/-//g;
-    return $value;
-}
-
 1;
 
 __END__
index 5338d8b5a67501573c7df56c0abbb4a05d0e371b..67e7b755572ab24b76211563001bba170706cda8 100644 (file)
@@ -18,6 +18,20 @@ if ($ENV{MOD_PERL}) {
 
 use Bugzilla::WebService::Constants;
 
+# Allow WebService methods to call XMLRPC::Lite's type method directly
+BEGIN {
+    *Bugzilla::WebService::type = sub {
+        my ($self, $type, $value) = @_;
+        if ($type eq 'dateTime') {
+            # This is the XML-RPC implementation,  see the README in Bugzilla/WebService/.
+            # Our "base" implementation is in Bugzilla::WebService::Server.
+            $value = Bugzilla::WebService::Server->datetime_format_outbound($value);
+            $value =~ s/-//g;
+        }
+        return XMLRPC::Data->type($type)->value($value);
+    };
+}
+
 sub initialize {
     my $self = shift;
     my %retval = $self->SUPER::initialize(@_);