Closed Bug 950871 Opened 11 years ago Closed 11 years ago

bugzilla_simple_shim should translate notification times into UTC

Categories

(Webtools :: Pulse, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mcote, Unassigned)

Details

Attachments

(1 file)

The BMO db presents its datetime values in the US/Pacific timezone.  The REST API, however, operates in UTC.  Since a very common action upon receiving a notification will be to query the REST API for details, we should serve notifications in UTC to make this operation simple.

This is a little complicated because I want the change notification system to (eventually) be useful to other Bugzilla installations, which may or may not use MySQL.  So we can't rely on MySQL to translate the times itself.  Thus the shim should do the translation.  Unfortunately this opens up potential DST problems (e.g. the one hour a year that repeats after the DST->ST transition), but since the notifications will generally be consumed very quickly after generation, this shouldn't be much of a problem in practice, if any.
Attachment #8348277 - Flags: review?(jgriffin)
Comment on attachment 8348277 [details] [diff] [review]
Support translation from local time to UTC

Review of attachment 8348277 [details] [diff] [review]:
-----------------------------------------------------------------

lgtm!

::: bugzilla_simple_shim.py
@@ +51,5 @@
>  
>      def publish(self, notification):
> +        delta_ts_dt = notification.delta_ts
> +        if (isinstance(delta_ts_dt, str) or
> +            isinstance(delta_ts_dt, unicode)):

or, more compactly:

if (isinstance(delta_ts_dt, basestring)):
Attachment #8348277 - Flags: review?(jgriffin) → review+
> ::: bugzilla_simple_shim.py
> @@ +51,5 @@
> >  
> >      def publish(self, notification):
> > +        delta_ts_dt = notification.delta_ts
> > +        if (isinstance(delta_ts_dt, str) or
> > +            isinstance(delta_ts_dt, unicode)):
> 
> or, more compactly:
> 
> if (isinstance(delta_ts_dt, basestring)):

Ah I knew there was a way. :) Thanks!

https://hg.mozilla.org/automation/pulseshims/rev/e39d5d64010f
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: