File tree Expand file tree Collapse file tree 3 files changed +19
-6
lines changed Expand file tree Collapse file tree 3 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -284,14 +284,22 @@ ipv4
284
284
ipv6 OS must have :func: `socket.inet_pton ` function
285
285
email
286
286
uri requires rfc3987 _
287
- date-time requires isodate _
287
+ date-time requires strict-rfc3339 _ [ # ]_
288
288
date
289
289
time
290
290
regex
291
291
color requires webcolors _
292
292
========== ====================
293
293
294
294
295
+ .. [# ] For backwards compatibility, isodate _ is also supported, but it will
296
+ allow any `ISO 8601 <http://en.wikipedia.org/wiki/ISO_8601 >`_ date-time,
297
+ not just `RFC 3339 <http://www.ietf.org/rfc/rfc3339.txt >`_ as mandated by
298
+ the JSON Schema specification.
299
+
300
+
301
+ .. _isodate : http://pypi.python.org/pypi/isodate/
295
302
.. _isodate : http://pypi.python.org/pypi/isodate/
296
303
.. _rfc3987 : http://pypi.python.org/pypi/rfc3987/
304
+ .. _strict-rfc3339 : http://pypi.python.org/pypi/strict-rfc3339/
297
305
.. _webcolors : http://pypi.python.org/pypi/webcolors/
Original file line number Diff line number Diff line change @@ -154,12 +154,17 @@ def is_uri(instance):
154
154
155
155
156
156
try :
157
- import isodate
157
+ import strict_rfc3339
158
158
except ImportError :
159
- pass
159
+ try :
160
+ import isodate
161
+ except ImportError :
162
+ pass
163
+ else :
164
+ _err = (ValueError , isodate .ISO8601Error )
165
+ _checks_drafts ("date-time" , raises = _err )(isodate .parse_datetime )
160
166
else :
161
- _err = (ValueError , isodate .ISO8601Error )
162
- _checks_drafts ("date-time" , raises = _err )(isodate .parse_datetime )
167
+ _checks_drafts ("date-time" )(strict_rfc3339 .validate_rfc3339 )
163
168
164
169
165
170
_checks_drafts ("regex" , raises = re .error )(re .compile )
Original file line number Diff line number Diff line change @@ -49,10 +49,10 @@ deps =
49
49
50
50
[testenv:all]
51
51
deps =
52
- isodate
53
52
lxml
54
53
pytest
55
54
sphinx
55
+ strict-rfc3339
56
56
webcolors
57
57
58
58
[flake8]
You can’t perform that action at this time.
0 commit comments