# HG changeset patch # User cmlenz # Date 1186946383 0 # Node ID d42e85b23272c3ad1aa471a6bd76f0196f814a6b # Parent 587b06d553233ac36c897f2c9624be7bf4b905ca `get_timezone_gmt()` wasn't getting the locale passed in all cases, which led to test errors when the default locale wasn't configured via environment variables. diff --git a/babel/dates.py b/babel/dates.py --- a/babel/dates.py +++ b/babel/dates.py @@ -174,15 +174,15 @@ as string indicating the offset from GMT. >>> dt = datetime(2007, 4, 1, 15, 30) - >>> get_timezone_gmt(dt) + >>> get_timezone_gmt(dt, locale='en') u'GMT+00:00' >>> from pytz import timezone >>> tz = timezone('America/Los_Angeles') >>> dt = datetime(2007, 4, 1, 15, 30, tzinfo=tz) - >>> get_timezone_gmt(dt) + >>> get_timezone_gmt(dt, locale='en') u'GMT-08:00' - >>> get_timezone_gmt(dt, 'short') + >>> get_timezone_gmt(dt, 'short', locale='en') u'-0800' The long format depends on the locale, for example in France a different @@ -191,8 +191,8 @@ >>> get_timezone_gmt(dt, 'long', locale='fr_FR') u'HMG-08:00' - :param dt: the ``datetime`` object; if `None`, the current date and time are - used + :param datetime: the ``datetime`` object; if `None`, the current date and + time are used :param width: either "long" or "short" :param locale: the `Locale` object, or a locale string :return: the GMT offset representation of the timezone @@ -799,7 +799,7 @@ if char == 'z': return get_timezone_name(self.value, width, locale=self.locale) elif char == 'Z': - return get_timezone_gmt(self.value, width) + return get_timezone_gmt(self.value, width, locale=self.locale) elif char == 'v': return get_timezone_name(self.value.tzinfo, width, locale=self.locale)