Skip to content

Commit

Permalink
corrected time_get function (datetime.time could be saved in odml but…
Browse files Browse the repository at this point in the history
… not reloaded ...)
  • Loading branch information
Lyuba Zehl committed Feb 13, 2015
1 parent e6cfb3c commit 48a2e8f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions odml/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class DType(str, Enum):
text = 'text'
int = 'int'
float = 'float'
URL = 'url'
url = 'url'
datetime = 'datetime'
date = 'date'
time = 'time'
Expand Down Expand Up @@ -50,7 +50,6 @@ def valid_type(dtype):
"""
if dtype in _dtype_map:
dtype = _dtype_map[dtype]

if hasattr(DType, dtype):
return True
if dtype is None:
Expand Down Expand Up @@ -146,9 +145,9 @@ def str_set(value):
def time_get(string):
if not string: return None
if type(string) is datetime.time:
return datetime.strptime(string.isoformat(), '%H:%M:%S').time()
return datetime.datetime.strptime(string.isoformat(), '%H:%M:%S').time()
else:
return datetime.strptime(string, '%H:%M:%S').time()
return datetime.datetime.strptime(string, '%H:%M:%S').time()


def time_set(value):
Expand Down

0 comments on commit 48a2e8f

Please sign in to comment.