def _load_results(self, context):
        try:
            results, content_type = BaseHandler._load_results(self, context)
        except Exception:
            logger.exception('[ImagesHandler] Exception during _load_results', extra=log_extra(context))
            self._error(500)
            return None, None

        return results, content_type
예제 #2
0
 def topic(self, coords):
     return (BaseHandler.translate_crop_coordinates(
         original_width=coords['original_width'],
         original_height=coords['original_height'],
         width=coords['width'],
         height=coords['height'],
         crop_left=coords['crop_left'],
         crop_top=coords['crop_top'],
         crop_right=coords['crop_right'],
         crop_bottom=coords['crop_bottom']), coords)
예제 #3
0
 def topic(self, coords):
     return (BaseHandler.translate_crop_coordinates(
         original_width=coords['original_width'],
         original_height=coords['original_height'],
         width=coords['width'],
         height=coords['height'],
         crop_left=coords['crop_left'],
         crop_top=coords['crop_top'],
         crop_right=coords['crop_right'],
         crop_bottom=coords['crop_bottom']
     ), coords)
예제 #4
0
 def setUp(self, *args, **kwargs):
     super(TranslateCoordinatesTestCase, self).setUp(*args, **kwargs)
     coords = self.get_coords()
     self.translate_crop_coordinates = BaseHandler.translate_crop_coordinates(
         original_width=coords['original_width'],
         original_height=coords['original_height'],
         width=coords['width'],
         height=coords['height'],
         crop_left=coords['crop_left'],
         crop_top=coords['crop_top'],
         crop_right=coords['crop_right'],
         crop_bottom=coords['crop_bottom'])
예제 #5
0
 def setUp(self, *args, **kwargs):
     super(TranslateCoordinatesTestCase, self).setUp(*args, **kwargs)
     coords = self.get_coords()
     self.translate_crop_coordinates = BaseHandler.translate_crop_coordinates(
         original_width=coords['original_width'],
         original_height=coords['original_height'],
         width=coords['width'],
         height=coords['height'],
         crop_left=coords['crop_left'],
         crop_top=coords['crop_top'],
         crop_right=coords['crop_right'],
         crop_bottom=coords['crop_bottom']
     )
예제 #6
0
 def setUp(self):
     super().setUp()
     coords = self.get_coords()
     crop_coords = BaseHandler.translate_crop_coordinates(
         original_width=coords["original_width"],
         original_height=coords["original_height"],
         width=coords["width"],
         height=coords["height"],
         crop_left=coords["crop_left"],
         crop_top=coords["crop_top"],
         crop_right=coords["crop_right"],
         crop_bottom=coords["crop_bottom"],
     )
     self.translate_crop_coordinates = crop_coords
예제 #7
0
 def topic(self):
     ctx = Context(None, Config(), None)
     application = ThumborServiceApp(ctx)
     handler = BaseHandler(application, MagicMock())
     handler._transforms = []
     return handler
 def _error(self, status, msg=None):
     return BaseHandler._old_error(self, status, msg)
 def _store_results(self, context, results):
     if results is not None:
         BaseHandler._store_results(self, context, results)
 def _write_results_to_client(self, context, results, content_type):
     if results is not None:
         BaseHandler._write_results_to_client(self, context, results, content_type)
예제 #11
0
 def topic(self):
     ctx = Context(None, Config(), None)
     application = ThumborServiceApp(ctx)
     handler = BaseHandler(application, MagicMock())
     handler._transforms = []
     return handler