# HG changeset patch # User cmlenz # Date 1270554301 0 # Node ID 3f3c1696ad39f677b0fbcd731aa7f09181b69cda # Parent 4facc0d65745bfd09bfe098715e7781cddfe3499 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 --- a/babel/dates.py +++ b/babel/dates.py @@ -208,7 +208,7 @@ 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':