summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Wagner <rwagner@mythtv.org>2011-07-24 16:37:27 (GMT)
committer Raymond Wagner <rwagner@mythtv.org>2011-07-24 16:40:52 (GMT)
commitcebd10c05ebd7484fdb5a6c9d497803e222623d9 (patch)
treefb80dac18d6c07ec173ed3614746d184e338e699
parent051c748f92df1d4652576bf3c64bbf7fc54cfad0 (diff)
Fix tzinfo handling in custom Python datetime class
Rename timezone class to _tzinfo to prevent conflicts with proper timezone handling. Correct regular expression to parse timezone offsets from ISO8601 format properly. Fixes #9937 (cherry picked from commit a606e972c7c3b28811c7bbb9ce82a64f854b271a)
-rw-r--r--mythtv/bindings/python/MythTV/utility.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/mythtv/bindings/python/MythTV/utility.py b/mythtv/bindings/python/MythTV/utility.py
index 9b28a20..2890d94 100644
--- a/mythtv/bindings/python/MythTV/utility.py
+++ b/mythtv/bindings/python/MythTV/utility.py
@@ -445,12 +445,12 @@ class datetime( _pydatetime ):
'(:(?P<sec>[0-9]{2}))?'
'(?P<tz>Z|'
'(?P<tzdirec>[-+])'
- '(?P<tzhour>[0-9]{1,2}?)'
+ '(?P<tzhour>[0-9]{1,2})'
'(:)?'
'(?P<tzmin>[0-9]{2})?'
')?')
- class tzinfo( _pytzinfo):
+ class _tzinfo( _pytzinfo):
def __init__(self, direc='+', hr=0, min=0):
if direc == '-':
hr = -1*int(hr)
@@ -481,11 +481,11 @@ class datetime( _pydatetime ):
dt.append(0)
if match.group('tz'):
if match.group('tz') == 'Z':
- tz = cls.tzinfo()
+ tz = cls._tzinfo()
elif match.group('tzmin'):
- tz = cls.tzinfo(*match.group('tzdirec','tzhour','tzmin'))
+ tz = cls._tzinfo(*match.group('tzdirec','tzhour','tzmin'))
else:
- tz = cls.tzinfo(*match.group('tzdirec','tzhour'))
+ tz = cls._tzinfo(*match.group('tzdirec','tzhour'))
dt.append(0)
dt.append(tz)
return cls(*dt)