changeset 457:f99a5c8e79b0

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.
author cmlenz
date Tue, 06 Apr 2010 11:45:01 +0000
parents fd955b04cd2f
children 5c5a0f3c93fa
files babel/dates.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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':
Copyright (C) 2012-2017 Edgewall Software