From ed8b6953bb1421cca3b7637b2b625447b9f3038b Mon Sep 17 00:00:00 2001 From: Roland Hedberg Date: Wed, 20 Feb 2013 14:48:12 +0100 Subject: [PATCH] editorial --- src/saml2/time_util.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/saml2/time_util.py b/src/saml2/time_util.py index 07a5075..57fdddf 100644 --- a/src/saml2/time_util.py +++ b/src/saml2/time_util.py @@ -149,16 +149,16 @@ def add_duration(tid, duration): if days < 1: pass elif days > maximum_day_in_month_for(year, month): - days = days - maximum_day_in_month_for(year, month) + days -= maximum_day_in_month_for(year, month) carry = 1 else: break temp = month + carry month = modulo(temp, 1, 13) - year = year + f_quotient(temp, 1, 13) + year += f_quotient(temp, 1, 13) - return time.localtime(time.mktime((year, month, days, hour, minutes, - secs, 0, 0, -1))) + return time.localtime(time.mktime((year, month, days, hour, minutes, + secs, 0, 0, -1))) else: pass @@ -232,7 +232,7 @@ def str_to_time(timestr, format=TIME_FORMAT): return 0 try: then = time.strptime(timestr, format) - except Exception: # assume it's a format problem + except ValueError, err: # assume it's a format problem try: elem = TIME_FORMAT_WITH_FRAGMENT.match(timestr) except Exception, exc: