Add stream decorator for HTTPMethodView

This commit is contained in:
38elements
2017-05-07 21:11:40 +09:00
parent 931397c7e1
commit 0b53c413a7
6 changed files with 67 additions and 3 deletions

View File

@@ -352,4 +352,7 @@ class Router:
:return: bool
"""
handler = self.get(request)[0]
if (hasattr(handler, 'view_class') and
hasattr(handler.view_class, request.method.lower())):
handler = getattr(handler.view_class, request.method.lower())
return hasattr(handler, 'is_stream') and handler.is_stream