@@ -237,22 +237,29 @@ def dispatch(self, method, uri, input):
237237 class_name , item_id , input )
238238
239239 output = data_obj (output )
240+ self .client .response_code = 200
240241 except IndexError , msg :
241242 output = error_obj (404 , msg )
243+ self .client .response_code = 404
242244 except Unauthorised , msg :
243245 output = error_obj (403 , msg )
246+ self .client .response_code = 403
244247 except (hyperdb .DesignatorError , UsageError ), msg :
245248 output = error_obj (400 , msg )
249+ self .client .response_code = 400
246250 except (AttributeError , Reject ), msg :
247251 output = error_obj (405 , 'Method Not Allowed. ' + str (msg ))
252+ self .client .response_code = 405
248253 except NotImplementedError :
249254 output = error_obj (402 , 'Method is under development' )
255+ self .client .response_code = 402
250256 # nothing to pay, just a mark for debugging purpose
251257 except :
252258 # if self.DEBUG_MODE in roundup_server
253259 # else msg = 'An error occurred. Please check...',
254260 exc , val , tb = sys .exc_info ()
255261 output = error_obj (400 , val )
262+ self .client .response_code = 400
256263
257264 # out to the logfile, it would be nice if the server do it for me
258265 print 'EXCEPTION AT' , time .ctime ()
0 commit comments