Esempio n. 1
0
 def save(self):
     """
     Save the image to the cache if provided and not cached yet.
     """
     if self.cache and not self.is_cached:
         image_str = StringIO.StringIO()
         self.pil.save(image_str, ext_to_format(self.cached_name))
         self.cache.set(self.cached_name, image_str.getvalue())
         image_str.close()
Esempio n. 2
0
 def save(self):
     """
     Save the image to the cache if provided and not cached yet.
     """
     if self.cache and not self.is_cached:
         image_str = BytesIO()
         self.pil.save(image_str, ext_to_format(self.cached_name))
         self.cache.set(self.cached_name, image_str.getvalue())
         image_str.close()
Esempio n. 3
0
 def render(self):
     """
     Renders the file content
     """
     if self.is_cached:
         return self.cache.get(self.cached_name)
     else:
         image_str = StringIO.StringIO()
         self.pil.save(image_str, ext_to_format(self.cached_name))
         return image_str.getvalue()
Esempio n. 4
0
 def render(self):
     """
     Renders the file content
     """
     if self.is_cached:
         return self.cache.get(self.cached_name)
     else:
         image_str = BytesIO()
         self.pil.save(image_str, ext_to_format(self.cached_name))
         return image_str.getvalue()