15
15
16
16
class BaseHandler :
17
17
_view_middleware = None
18
- _template_response_middleware = None
19
18
_exception_middleware = None
20
19
_middleware_chain = None
21
20
@@ -26,7 +25,6 @@ def load_middleware(self):
26
25
Must be called after the environment is fixed (see __call__ in subclasses).
27
26
"""
28
27
self ._view_middleware = []
29
- self ._template_response_middleware = []
30
28
self ._exception_middleware = []
31
29
32
30
get_response = self ._get_response
@@ -61,10 +59,6 @@ def load_middleware(self):
61
59
0 ,
62
60
self .adapt_method_mode (mw_instance .process_view ),
63
61
)
64
- if hasattr (mw_instance , "process_template_response" ):
65
- self ._template_response_middleware .append (
66
- self .adapt_method_mode (mw_instance .process_template_response ),
67
- )
68
62
if hasattr (mw_instance , "process_exception" ):
69
63
# The exception-handling stack is still always synchronous for
70
64
# now, so adapt that way.
@@ -145,27 +139,6 @@ def _get_response(self, request):
145
139
# Complain if the view returned None (a common error).
146
140
self .check_response (response , callback )
147
141
148
- # If the response supports deferred rendering, apply template
149
- # response middleware and then render the response
150
- if hasattr (response , "render" ) and callable (response .render ):
151
- for middleware_method in self ._template_response_middleware :
152
- response = middleware_method (request , response )
153
- # Complain if the template response middleware returned None
154
- # (a common error).
155
- self .check_response (
156
- response ,
157
- middleware_method ,
158
- name = "{}.process_template_response" .format (
159
- middleware_method .__self__ .__class__ .__name__
160
- ),
161
- )
162
- try :
163
- response = response .render ()
164
- except Exception as e :
165
- response = self .process_exception_by_middleware (e , request )
166
- if response is None :
167
- raise
168
-
169
142
return response
170
143
171
144
def resolve_request (self , request ):
0 commit comments