Skip to content

Commit

Permalink
Correct datetime queries for DBDataRef and DBDataCRef classes.
Browse files Browse the repository at this point in the history
This ensures datetime values used in the WHERE block for referenced and
crossreferenced database tables are properly made timezone naive.
  • Loading branch information
wagnerrp committed Sep 26, 2012
1 parent c7f0676 commit 6a8a845
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions mythtv/bindings/python/MythTV/database.py
Expand Up @@ -529,9 +529,14 @@ def __init__(self, where, db=None, bypass=False):
self._setClassDefs(self._db)
if bypass: return

self._refdat = where
self._populated = False

where = list(where)
for i,v in enumerate(where):
if isinstance(v, datetime):
where[i] = v.asnaiveutc()
self._refdat = tuple(where)

def _populate(self, force=False, data=None):
if self._populated and (not force):
return
Expand Down Expand Up @@ -681,9 +686,14 @@ def __init__(self, where, db=None, bypass=False):
self._setClassDefs(self._db)
if bypass: return

self._refdat = list(where)
self._populated = False

where = list(where)
for i,v in enumerate(where):
if isinstance(v, datetime):
where[i] = v.asnaiveutc()
self._refdat = tuple(where)

def _populate(self, force=False, data=None):
if self._populated and (not force):
return
Expand Down

0 comments on commit 6a8a845

Please sign in to comment.