From: Christopher Lenz Date: Sun, 12 Aug 2007 19:19:43 +0000 (+0000) Subject: `get_timezone_gmt()` wasn't getting the locale passed in all cases, which led to... X-Git-Tag: 1.0~402 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9e8bf8aa644d63ec44335f0193cb6f8714310ac;p=thirdparty%2Fbabel.git `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 index c1ca2b82..fd6db45a 100644 --- a/babel/dates.py +++ b/babel/dates.py @@ -174,15 +174,15 @@ def get_timezone_gmt(datetime=None, width='long', locale=LC_TIME): 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 @@ def get_timezone_gmt(datetime=None, width='long', locale=LC_TIME): >>> 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 @@ class DateTimeFormat(object): 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)