changeset 3854:30240e801a55

cache action: add some hint, cosmetic changes
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 14 Jul 2008 19:44:28 +0200
parents 3b37036d466d
children 5e35dd32656f
files MoinMoin/action/cache.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/cache.py	Mon Jul 14 19:14:06 2008 +0200
+++ b/MoinMoin/action/cache.py	Mon Jul 14 19:44:28 2008 +0200
@@ -55,6 +55,11 @@
     we read it ourselves from the attachment file), but we just calculate a key
     from the given metadata values and some metadata we get from the filesystem.
 
+    Hint: if you need multiple cache objects for the same source content (e.g.
+          thumbnails of different sizes for the same image), calculate the key
+          only once and then add some different prefixes to it to get the final
+          cache keys.
+
     @param request: the request object
     @param wikiname: the name of the wiki (if not given, will be read from cfg)
     @param itemname: the name of the page
@@ -137,10 +142,7 @@
         # TODO: fix the encoding here, plain 8 bit is not allowed according to the RFCs
         # There is no solution that is compatible to IE except stripping non-ascii chars
         filename = filename.encode(config.charset)
-
-        headers.append(
-               'Content-Disposition: %s; filename="%s"' % (content_disposition, filename)
-        )
+        headers.append('Content-Disposition: %s; filename="%s"' % (content_disposition, filename))
 
     meta_cache = caching.CacheEntry(request, cache_arena, key+'.meta', cache_scope, do_locking=do_locking, use_pickle=True)
     meta_cache.update((last_modified, headers))