# HG changeset patch # User cmlenz # Date 1270554301 0 # Node ID fa3e4295f7b89df99ac4afcad3252676c27f24f2 # Parent 605b06c445bc7334791b776027e2cb1599f4367c 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':