@@ -187,8 +187,8 @@ def get_swagger(self, request):
187187 """
188188 api_base = self .parent
189189 if not api_base :
190- raise HttpError (404 , 40442 , "Swagger not available." ,
191- "Swagger API is detached from a parent container." )
190+ raise HttpError (HTTPStatus . NOT_FOUND , 42 , "Swagger not available." ,
191+ "Swagger API is detached from a parent container." )
192192
193193 paths , definitions = self .parse_operations ()
194194 return dict_filter ({
@@ -208,17 +208,17 @@ def get_swagger(self, request):
208208
209209 def load_static (self , file_name ):
210210 if not self .enable_ui :
211- raise HttpError (404 , 40401 , "Not found" )
211+ raise HttpError (HTTPStatus . NOT_FOUND , 42 )
212212
213213 static_path = os .path .join (os .path .dirname (__file__ ), 'static' )
214214 file_path = os .path .abspath (os .path .join (static_path , file_name ))
215215 if not file_path .startswith (static_path ):
216- raise HttpError (404 , 40401 , "Not found" )
216+ raise HttpError (HTTPStatus . NOT_FOUND , 42 )
217217
218218 try :
219219 return open (file_path , 'rb' ).read ()
220220 except OSError :
221- raise HttpError (404 , 40401 , "Not found" )
221+ raise HttpError (HTTPStatus . NOT_FOUND , 42 )
222222
223223 @doc .response (HTTPStatus .OK , "HTML content" )
224224 @doc .produces ('text/html' )
@@ -243,7 +243,7 @@ def get_static(self, _, file_name=None):
243243 'js' : 'application/javascript' ,
244244 }.get (file_name [- 2 :])
245245 if not content_type :
246- raise ImmediateHttpResponse ( "Not Found" , 404 )
246+ raise HttpError ( HTTPStatus . NOT_FOUND , 42 )
247247
248248 return HttpResponse (self .load_static (file_name ), headers = {
249249 'Content-Type' : content_type ,
0 commit comments