devtools/testlib.py
changeset 8721 b399c87df63c
parent 8720 d2f01aaae8c0
child 8725 29e19ca141fc
equal deleted inserted replaced
8720:d2f01aaae8c0 8721:b399c87df63c
   702         req = self.req_from_url(url)
   702         req = self.req_from_url(url)
   703         if data is not None:
   703         if data is not None:
   704             req.form.update(data)
   704             req.form.update(data)
   705         ctrlid, rset = self.app.url_resolver.process(req, req.relative_path(False))
   705         ctrlid, rset = self.app.url_resolver.process(req, req.relative_path(False))
   706         return self.ctrl_publish(req, ctrlid, rset)
   706         return self.ctrl_publish(req, ctrlid, rset)
       
   707 
       
   708     def http_publish(self, url, data=None):
       
   709         """like `url_publish`, except this returns a http response, even in case of errors"""
       
   710         req = self.req_from_url(url)
       
   711         if data is not None:
       
   712             req.form.update(data)
       
   713         # remove the monkey patched error handler
       
   714         fake_error_handler = self.app.error_handler
       
   715         del self.app.error_handler
       
   716         try:
       
   717             result = self.app_handle_request(req, req.relative_path(False))
       
   718         finally:
       
   719             self.app.error_handler = fake_error_handler
       
   720         return result, req
   707 
   721 
   708     @staticmethod
   722     @staticmethod
   709     def _parse_location(req, location):
   723     def _parse_location(req, location):
   710         try:
   724         try:
   711             path, params = location.split('?', 1)
   725             path, params = location.split('?', 1)