From: Christopher Lenz Date: Tue, 6 Apr 2010 11:45:01 +0000 (+0000) Subject: Workaround for a weird bug with newer versions of pytz, which fails when `utcoffset... X-Git-Tag: 1.0~238 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f099d39553188d9bc56f7721ea40ece9f0959cd;p=thirdparty%2Fbabel.git Workaround for a weird bug with newer versions of pytz, which fails when `utcoffset()` gets passed a `None` argument. Which it shouldn't be getting in the first place. --- diff --git a/babel/dates.py b/babel/dates.py index 7e39368e..72c495c3 100644 --- a/babel/dates.py +++ b/babel/dates.py @@ -208,7 +208,7 @@ def get_timezone_gmt(datetime=None, width='long', locale=LC_TIME): datetime = datetime.replace(tzinfo=UTC) locale = Locale.parse(locale) - offset = datetime.utcoffset() + offset = datetime.tzinfo.utcoffset(datetime) seconds = offset.days * 24 * 60 * 60 + offset.seconds hours, seconds = divmod(seconds, 3600) if width == 'short':