Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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 a606e97)
  • Loading branch information...
commit cebd10c05ebd7484fdb5a6c9d497803e222623d9 1 parent 051c748
@wagnerrp wagnerrp authored
Showing with 5 additions and 5 deletions.
  1. +5 −5 mythtv/bindings/python/MythTV/utility.py
View
10 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 @@ def fromIso(cls, isotime, sep='T'):
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)
Please sign in to comment.
Something went wrong with that request. Please try again.