changeset 5423:7d0598a55c09

merged main
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 11 Jan 2010 08:59:27 +0100
parents ddfd18e00523 (diff) eaef92e05011 (current diff)
children f619c99ab12f bd55be7c3886
files
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/auth/openidrp_ext/openidrp_sreg.py	Mon Jan 11 00:37:26 2010 +0100
+++ b/MoinMoin/auth/openidrp_ext/openidrp_sreg.py	Mon Jan 11 08:59:27 2010 +0100
@@ -80,11 +80,16 @@
                     sreg['language'] = sreg['language'][0:2]
         # Timezone must be converted to offset in seconds
         if sreg_resp.get('timezone'):
-            user_tz = timezone(sreg_resp.get('timezone').encode('ascii'))
-            if user_tz:
-                user_utcoffset = user_tz.utcoffset(datetime.utcnow())
-                sreg['timezone'] = user_utcoffset.days * 24 * 60 * 60 + user_utcoffset.seconds
+            try:
+                user_tz = timezone(sreg_resp.get('timezone').encode('ascii'))
+            except pytz.UnknownTimeZoneError:
+                pass # don't use
             else:
-                sreg['timezone'] = 0
+                if user_tz:
+                    user_utcoffset = user_tz.utcoffset(datetime.utcnow())
+                    sreg['timezone'] = user_utcoffset.days * 24 * 60 * 60 + user_utcoffset.seconds
+                else:
+                    # XXX when does user_tz get falsy? if it does, shouldn't we just 'pass'?
+                    sreg['timezone'] = 0
     return sreg