Skip to content

Commit e9c7991

Browse files
committed
Support passing strings to xsd:Time objects (#540)
1 parent 246aa43 commit e9c7991

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- Update packaging (stop using find_packages()) (#529)
77
- Properly handle None values when rendering complex types (#526)
88
- Fix generating signature for empty wsdl messages (#542)
9+
- Support passing strings to xsd:Time objects (#540)
910

1011

1112
2.3.0 (2017-08-06)

src/zeep/xsd/types/builtins.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ class Time(BuiltinType, AnySimpleType):
147147

148148
@check_no_collection
149149
def xmlvalue(self, value):
150+
if isinstance(value, six.string_types):
151+
return value
152+
150153
if value.microsecond:
151154
return isodate.isostrf.strftime(value, '%H:%M:%S.%f%Z')
152155
return isodate.isostrf.strftime(value, '%H:%M:%S%Z')

tests/test_xsd_builtins.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ def test_xmlvalue(self):
151151
instance = builtins.Time()
152152
value = datetime.time(21, 14, 42)
153153
assert instance.xmlvalue(value) == '21:14:42'
154+
assert instance.xmlvalue("21:14:42") == '21:14:42'
154155

155156
def test_pythonvalue(self):
156157
instance = builtins.Time()

0 commit comments

Comments
 (0)