Skip to content
This repository was archived by the owner on Oct 30, 2018. It is now read-only.

Commit f3c1685

Browse files
chulkileebcoca
authored andcommitted
osx_defaults: fix datetime
Fix #1742
1 parent 154afa7 commit f3c1685

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

system/osx_defaults.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
- osx_defaults: domain=com.geekchimp.macable key=ExampleKeyToRemove state=absent
8484
'''
8585

86-
from datetime import datetime
86+
import datetime
8787

8888
# exceptions --------------------------------------------------------------- {{{
8989
class OSXDefaultsException(Exception):
@@ -141,7 +141,7 @@ def _convert_type(self, type, value):
141141
raise OSXDefaultsException("Invalid boolean value: {0}".format(repr(value)))
142142
elif type == "date":
143143
try:
144-
return datetime.strptime(value.split("+")[0].strip(), "%Y-%m-%d %H:%M:%S")
144+
return datetime.datetime.strptime(value.split("+")[0].strip(), "%Y-%m-%d %H:%M:%S")
145145
except ValueError:
146146
raise OSXDefaultsException(
147147
"Invalid date value: {0}. Required format yyy-mm-dd hh:mm:ss.".format(repr(value))
@@ -240,7 +240,7 @@ def write(self):
240240
value = str(self.value)
241241
elif self.array_add and self.current_value is not None:
242242
value = list(set(self.value) - set(self.current_value))
243-
elif isinstance(self.value, datetime):
243+
elif isinstance(self.value, datetime.datetime):
244244
value = self.value.strftime('%Y-%m-%d %H:%M:%S')
245245
else:
246246
value = self.value

0 commit comments

Comments
 (0)