Skip to content
This repository has been archived by the owner on Jul 13, 2019. It is now read-only.

Commit

Permalink
Cleaned up util.py
Browse files Browse the repository at this point in the history
  • Loading branch information
geertw committed Aug 29, 2015
1 parent 3afcd71 commit d1ed22c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions serviceinfo/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,21 @@ def parse_str_int(string):
return int(string)


def parse_sql_time(date, time, timezone=None):
def parse_sql_time(date, time, tz=None):
"""
Parse a time returned by MySQLdb and combine the returned
timedelta object with a given date.
Returns None when time is None.
"""

if time == None:
if time is None:
return time
else:
date = datetime.datetime.combine(date,
datetime.datetime.min.time()) + time
date = datetime.datetime.combine(date, datetime.datetime.min.time()) + time

if timezone != None:
date = timezone.localize(date)
if tz is not None:
date = tz.localize(date)
return date


Expand All @@ -74,7 +73,7 @@ def datetime_to_iso(date_time):
Returns None when date_time is None.
"""

if date_time == None:
if date_time is None:
return None
else:
return date_time.isoformat()
Expand Down

0 comments on commit d1ed22c

Please sign in to comment.