def process_images(self, fits_headers={}, **kwargs):
            assert self.images_exist, self.logger.warning("No images to process")
            start_time = current_time()

            self.logger.debug("Processing images: {}".format(self.images))

            for cam_name, img_info in self.images.items():
                self.logger.debug("Cam {} Info {}".format(cam_name, img_info))

                fits_headers['detname'] = img_info.get('camera_id', '')

                kwargs['primary'] = img_info.get('primary', False)
                kwargs['make_pretty'] = img_info.get('primary', False)

                processsed_info = images.process_cr2(img_info.get('img_file'), fits_headers=fits_headers, **kwargs)

                self.logger.debug("Processed image info: {}".format(processsed_info))

                img_info.update(processsed_info)
                self.logger.debug("Done processing")

            # End total processing time
            end_time = current_time()
            self.logger.debug("Processing time: {}".format((end_time - start_time).to(u.s)))
Use this decorator on the dispatch method of a TemplateView subclass
dataset/ETHPy150Open panoptes/POCS/panoptes/scheduler/observation.py/Observation.Exposure.process_images--crossover with--dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/style/decorators.py/use_jquery_ui_multiselect