diff options
Diffstat (limited to 'dev-python/icalendar/files/2.1_p20100409/03_all_duration-fix.patch')
-rw-r--r-- | dev-python/icalendar/files/2.1_p20100409/03_all_duration-fix.patch | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/dev-python/icalendar/files/2.1_p20100409/03_all_duration-fix.patch b/dev-python/icalendar/files/2.1_p20100409/03_all_duration-fix.patch new file mode 100644 index 00000000000..d6d857a342d --- /dev/null +++ b/dev-python/icalendar/files/2.1_p20100409/03_all_duration-fix.patch @@ -0,0 +1,33 @@ +--- src/icalendar/prop.py.old Mon Dec 14 13:43:50 2009 ++++ src/icalendar/prop.py Tue Jan 19 15:09:58 2010 +@@ -57,7 +57,7 @@ + TIME_PART = r'T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?' + DATETIME_PART = '(?:%s)?(?:%s)?' % (DATE_PART, TIME_PART) + WEEKS_PART = r'(\d+)W' +-DURATION_REGEX = re.compile(r'([-+]?)P(?:%s|%s)$' ++DURATION_REGEX = re.compile(r'([-+]?)P(?:%s)?(?:%s)?$' + % (WEEKS_PART, DATETIME_PART)) + WEEKDAY_RULE = re.compile('(?P<signal>[+-]?)(?P<relative>[\d]?)' + '(?P<weekday>[\w]{2})$') +@@ -467,14 +467,14 @@ + """ + try: + match = DURATION_REGEX.match(ical) ++ if not any(match.groups()): ++ raise ValueError() + sign, weeks, days, hours, minutes, seconds = match.groups() +- if weeks: +- value = timedelta(weeks=int(weeks)) +- else: +- value = timedelta(days=int(days or 0), +- hours=int(hours or 0), +- minutes=int(minutes or 0), +- seconds=int(seconds or 0)) ++ value = timedelta(weeks=int(weeks or 0), ++ days=int(days or 0), ++ hours=int(hours or 0), ++ minutes=int(minutes or 0), ++ seconds=int(seconds or 0)) + if sign == '-': + value = -value + return value |