29
29
import numbers
30
30
import re
31
31
import time
32
+ import warnings
32
33
33
34
from tornado .escape import native_str , parse_qs_bytes , utf8
34
35
from tornado .log import gen_log
@@ -380,10 +381,15 @@ def supports_http_1_1(self):
380
381
"""Returns True if this request supports HTTP/1.1 semantics.
381
382
382
383
.. deprecated:: 4.0
383
- Applications are less likely to need this information with the
384
- introduction of `.HTTPConnection`. If you still need it, access
385
- the ``version`` attribute directly.
384
+
385
+ Applications are less likely to need this information with
386
+ the introduction of `.HTTPConnection`. If you still need
387
+ it, access the ``version`` attribute directly. This method
388
+ will be removed in Tornado 6.0.
389
+
386
390
"""
391
+ warnings .warn ("supports_http_1_1() is deprecated, use request.version instead" ,
392
+ DeprecationWarning )
387
393
return self .version == "HTTP/1.1"
388
394
389
395
@property
@@ -412,8 +418,10 @@ def write(self, chunk, callback=None):
412
418
413
419
.. deprecated:: 4.0
414
420
Use ``request.connection`` and the `.HTTPConnection` methods
415
- to write the response.
421
+ to write the response. This method will be removed in Tornado 6.0.
416
422
"""
423
+ warnings .warn ("req.write deprecated, use req.connection.write and write_headers instead" ,
424
+ DeprecationWarning )
417
425
assert isinstance (chunk , bytes )
418
426
assert self .version .startswith ("HTTP/1." ), \
419
427
"deprecated interface only supported in HTTP/1.x"
@@ -424,8 +432,10 @@ def finish(self):
424
432
425
433
.. deprecated:: 4.0
426
434
Use ``request.connection`` and the `.HTTPConnection` methods
427
- to write the response.
435
+ to write the response. This method will be removed in Tornado 6.0.
428
436
"""
437
+ warnings .warn ("req.finish deprecated, use req.connection.finish instead" ,
438
+ DeprecationWarning )
429
439
self .connection .finish ()
430
440
self ._finish_time = time .time ()
431
441
0 commit comments