[mythtv-commits] Ticket #9937: MythTV datetime class shouldn't have nested tzinfo class

MythTV noreply at mythtv.org
Sun Jul 24 15:33:10 UTC 2011


#9937: MythTV datetime class shouldn't have nested tzinfo class
----------------------------------------+------------------------
     Reporter:  richardfearn@…          |      Owner:  wagnerrp
         Type:  Bug Report - General    |     Status:  new
     Priority:  minor                   |  Milestone:  0.24.1
    Component:  Bindings - Python       |    Version:  0.24-fixes
     Severity:  low                     |   Keywords:
Ticket locked:  0                       |
----------------------------------------+------------------------
 {{{MythTV.utility.datetime}}} has a nested class, {{{tzinfo}}}. This means
 the {{{tzinfo}}} attribute of {{{datetime}}} instances is the {{{tzinfo}}}
 type. However, this attribute is supposed to be a {{{tzinfo}}}
 '''instance'''. The {{{datetime}}} library gets confused by this.

 It would be better to move {{{tzinfo}}} out of the {{{datetime}}} class,
 so that the {{{tzinfo}}} attribute can be an instance, or {{{None}}}.

 For example, when MythTV creates a {{{datetime}}} object using a
 timestamp, {{{tzinfo}}} should be {{{None}}}, as there is no timestamp
 information. However {{{tzinfo}}} is the {{{tzinfo}}} class. A workaround
 is to copy the {{{datetime}}} object:

 {{{
 mythtv_time = prog.starttime    # for example
 new_time = datetime.fromtimestamp(mythtv_time.timestamp())
 }}}

 I found this while fixing
 [http://code.google.com/p/mythcal/issues/detail?id=6 an issue in mythcal].

-- 
Ticket URL: <http://code.mythtv.org/trac/ticket/9937>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center


More information about the mythtv-commits mailing list