# HG changeset patch # User Thomas Waldmann # Date 1216331682 -7200 # Node ID a1a6a45edaf1e94bb0ed71a1097bdc6bcf3bf96a # Parent a0c61c78446e499bfe2d27a76ba0142fc0b5f2b3 arnica: use StringIO file obj for cache.put(), remove unused code diff -r a0c61c78446e -r a1a6a45edaf1 data/plugin/parser/text_x_arnica.py --- a/data/plugin/parser/text_x_arnica.py Thu Jul 17 23:30:23 2008 +0200 +++ b/data/plugin/parser/text_x_arnica.py Thu Jul 17 23:54:42 2008 +0200 @@ -518,11 +518,8 @@ cache_web = caching.CacheEntry(self.request, cache.cache_arena, webnail+'.data', cache.cache_scope, do_locking=False) - webnail_image_filename = cache_web._filename() - cache_thumb = caching.CacheEntry(self.request, cache.cache_arena, thumbnail+'.data', cache.cache_scope, do_locking=False) - thumbnail_image_filename = cache_thumb._filename() if self.renew: cache_web.remove() @@ -540,19 +537,21 @@ if not cache_web.exists(): if not self.image_for_webnail: im_obj.thumbnail((int(self.webnail_width.strip('px')), int(self.webnail_width.strip('px'))), Image.ANTIALIAS) - buffer = StringIO.StringIO() - im_obj.save(buffer, image_type) - buffer.flush() - cache.put(self.request, webnail, buffer.getvalue(), filename=image) - buffer.close() + buf = StringIO.StringIO() + im_obj.save(buf, image_type) + buf.flush() + buf.seek(0) + cache.put(self.request, webnail, buf, filename=image) + buf.close() if not cache_thumb.exists(): im_obj.thumbnail((int(self.thumbnail_width.strip('px')), int(self.thumbnail_width.strip('px'))), Image.ANTIALIAS) - buffer = StringIO.StringIO() - im_obj.save(buffer, image_type) - buffer.flush() - cache.put(self.request, thumbnail, buffer.getvalue(), filename=image) - buffer.close() + buf = StringIO.StringIO() + im_obj.save(buf, image_type) + buf.flush() + buf.seek(0) + cache.put(self.request, thumbnail, buf, filename=image) + buf.close() def render(self, formatter): """ renders thumbnails """