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:37:27 (GMT)
commita606e972c7c3b28811c7bbb9ce82a64f854b271a (patch)
tree811d182937f1e51c54493267576f7f31ef486a3f
parentcb38a5279fd3f2b8fd554c138310b3a381f7d014 (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
-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 a95350b..277a2e8 100644
--- a/mythtv/bindings/python/MythTV/utility.py
+++ b/mythtv/bindings/python/MythTV/utility.py
@@ -473,12 +473,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)
@@ -509,11 +509,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)