Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
9947ffcb
Commit
9947ffcb
authored
Mar 07, 2010
by
Max Kanat-Alexander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 550618: Make the XML-RPC WebService return the right date format
r=dkl, a=mkanat
parent
f2660e7a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
16 deletions
+26
-16
WebService.pm
Bugzilla/WebService.pm
+9
-16
Server.pm
Bugzilla/WebService/Server.pm
+17
-0
No files found.
Bugzilla/WebService.pm
View file @
9947ffcb
...
...
@@ -19,10 +19,9 @@
# actual RPC server, see Bugzilla::WebService::Server and its subclasses.
package
Bugzilla::
WebService
;
use
strict
;
use
Date::
Parse
;
use
Bugzilla::WebService::
Server
;
use
XMLRPC::
Lite
;
use
Bugzilla::
Util
qw(datetime_from)
;
use
Scalar::
Util
qw(blessed)
;
# Used by the JSON-RPC server to convert incoming date fields apprpriately.
use
constant
DATE_FIELDS
=>
{};
...
...
@@ -43,22 +42,16 @@ sub type {
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
,
$date
)
=
@_
;
my
$time
=
$date
;
if
(
blessed
(
$date
))
{
# We expect this to mean we were sent a datetime object
$time
->
set_time_zone
(
'UTC'
);
}
else
{
# We always send our time in UTC, for consistency.
# passed in value is likely a string, create a datetime object
$time
=
datetime_from
(
$date
,
'UTC'
);
}
return
$time
->
iso8601
();
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__
...
...
Bugzilla/WebService/Server.pm
View file @
9947ffcb
...
...
@@ -21,6 +21,8 @@ use strict;
use
Bugzilla::
Error
;
use
Bugzilla::
Util
qw(datetime_from)
;
use
Scalar::
Util
qw(blessed)
;
sub
handle_login
{
my
(
$self
,
$class
,
$method
,
$full_method
)
=
@_
;
eval
"require $class"
;
...
...
@@ -38,4 +40,19 @@ sub datetime_format_inbound {
return
$time
}
sub
datetime_format_outbound
{
my
(
$self
,
$date
)
=
@_
;
my
$time
=
$date
;
if
(
blessed
(
$date
))
{
# We expect this to mean we were sent a datetime object
$time
->
set_time_zone
(
'UTC'
);
}
else
{
# We always send our time in UTC, for consistency.
# passed in value is likely a string, create a datetime object
$time
=
datetime_from
(
$date
,
'UTC'
);
}
return
$time
->
iso8601
();
}
1
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment