4
4
from .constants import OK , CREATED , ACCEPTED , NO_CONTENT
5
5
from .data import Data
6
6
from .exceptions import MethodNotImplemented , Unauthorized
7
- from .preparers import Preparer , FieldsPreparer
7
+ from .preparers import Preparer
8
8
from .serializers import JSONSerializer
9
9
from .utils import format_traceback
10
10
@@ -145,9 +145,8 @@ def request_method(self):
145
145
"""
146
146
Returns the HTTP method for the current request.
147
147
148
- The default implementation is Django-specific, so if you're integrating
149
- with a new web framework, you'll need to override this method within
150
- your subclass.
148
+ If you're integrating with a new web framework, you might need to
149
+ override this method within your subclass.
151
150
152
151
:returns: The HTTP method in uppercase
153
152
:rtype: string
@@ -161,9 +160,8 @@ def request_body(self):
161
160
162
161
Useful for deserializing the content the user sent (typically JSON).
163
162
164
- The default implementation is Django-specific, so if you're integrating
165
- with a new web framework, you'll need to override this method within
166
- your subclass.
163
+ If you're integrating with a new web framework, you might need to
164
+ override this method within your subclass.
167
165
168
166
:returns: The body of the request
169
167
:rtype: string
@@ -175,9 +173,8 @@ def build_response(self, data, status=200):
175
173
"""
176
174
Given some data, generates an HTTP response.
177
175
178
- The default implementation is Django-specific, so if you're integrating
179
- with a new web framework, you'll need to override this method within
180
- your subclass.
176
+ If you're integrating with a new web framework, you **MUST**
177
+ override this method within your subclass.
181
178
182
179
:param data: The body of the response to send
183
180
:type data: string
@@ -188,13 +185,7 @@ def build_response(self, data, status=200):
188
185
189
186
:returns: A response object
190
187
"""
191
- # TODO: Remove the Django.
192
- # This should be plain old WSGI by default, if possible.
193
- # By default, Django-esque.
194
- from django .http import HttpResponse
195
- resp = HttpResponse (data , content_type = 'application/json' )
196
- resp .status_code = status
197
- return resp
188
+ raise NotImplementedError ()
198
189
199
190
def build_error (self , err ):
200
191
"""
0 commit comments