From 0b09463f193deb4bb2793210bf30301ea9d4d8fc Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" Date: Fri, 10 Apr 2009 22:09:40 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20487865:=20Exporting=20bugs=20in=20XML=20f?= =?UTF-8?q?ormat=20uses=20non-unique=20timezones=20(they=20cannot=20be=20i?= =?UTF-8?q?mported=20back)=20-=20Patch=20by=20Fr=C3=83=C2=A9d=C3=83=C2=A9r?= =?UTF-8?q?ic=20Buclin=20=20r=3Dghendricks=20a=3DLpSoli?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://10.0.0.236/trunk@256886 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/Bugzilla/Util.pm | 7 +++++++ .../bugzilla/template/en/default/bug/show.xml.tmpl | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/mozilla/webtools/bugzilla/Bugzilla/Util.pm b/mozilla/webtools/bugzilla/Bugzilla/Util.pm index 398957b13a2..7ed20c87521 100644 --- a/mozilla/webtools/bugzilla/Bugzilla/Util.pm +++ b/mozilla/webtools/bugzilla/Bugzilla/Util.pm @@ -426,6 +426,13 @@ sub format_time { # strptime($date) returns an empty array if $date has an invalid date format. my @time = strptime($date); + unless (scalar @time) { + # If an unknown timezone is passed (such as MSK, for Moskow), strptime() is + # unable to parse the date. We try again, but we first remove the timezone. + $date =~ s/\s+\S+$//; + @time = strptime($date); + } + if (scalar @time) { # Fix a bug in strptime() where seconds can be undefined in some cases. $time[0] ||= 0; diff --git a/mozilla/webtools/bugzilla/template/en/default/bug/show.xml.tmpl b/mozilla/webtools/bugzilla/template/en/default/bug/show.xml.tmpl index cd7f44eff99..cb0b10a4298 100644 --- a/mozilla/webtools/bugzilla/template/en/default/bug/show.xml.tmpl +++ b/mozilla/webtools/bugzilla/template/en/default/bug/show.xml.tmpl @@ -79,7 +79,7 @@ [% NEXT IF c.isprivate && !user.in_group(Param("insidergroup")) %] [% c.author.email FILTER email FILTER xml %] - [% c.time FILTER time FILTER xml %] + [% c.time FILTER time("%Y-%m-%d %T %z") FILTER xml %] [% IF user.in_group(Param('timetrackinggroup')) && (c.work_time - 0 != 0) %] [% PROCESS formattimeunit time_unit = c.work_time FILTER xml %] [% END %] @@ -97,7 +97,7 @@ isprivate="[% a.isprivate FILTER xml %]" > [% a.id %] - [% a.attached FILTER time FILTER xml %] + [% a.attached FILTER time("%Y-%m-%d %R %z") FILTER xml %] [% a.description FILTER xml %] [% a.filename FILTER xml %] [% a.contenttype FILTER xml %] @@ -146,7 +146,7 @@ [% ELSIF field == 'cc' %] [% val = val FILTER email %] [% ELSIF field == 'creation_ts' OR field == 'delta_ts' %] - [% val = val FILTER time %] + [% val = val FILTER time("%Y-%m-%d %T %z") %] [% END %] <[% field %][% IF name != '' %] name="[% name FILTER xml %]"[% END -%]> [%- val FILTER xml %]