Attachment 'Cachetest.py'

Download

   1 # -*- coding: iso-8859-1 -*-
   2 """
   3     Cachetest
   4 
   5     this macro is used to find a problem of fuid
   6 
   7     @copyright: 2009 MoinMoin:ReimarBauer
   8 
   9     @license: GNU GPL, see COPYING for details.
  10 """
  11 from MoinMoin import caching, wikiutil
  12 from MoinMoin.action import AttachFile, cache
  13 
  14 def macro_Cachetest(macro, attachment=unicode):
  15     request = macro.request
  16     pagename = request.page.page_name
  17 
  18     Image = wikiutil.importWikiPlugin(request.cfg, "macro", "Image", function="Image")
  19     size = (128, 128)
  20     cache_arena = 'sendcache'
  21     cache_scope = 'wiki'
  22     do_locking = False
  23     if attachment and AttachFile.exists(request, pagename, attachment):
  24         itemname = pagename + '/' + attachment
  25         img = Image(request, itemname)
  26         content_type = img.content_type
  27         size_str = '%d_%d' % size
  28         key = '%s_%s_%s' % (content_type.replace('/', '_'), size_str, img._cache_key)
  29         meta_cache = caching.CacheEntry(request, cache_arena, key+'.meta', cache_scope, do_locking=do_locking, use_pickle=True)
  30         result = """
  31 IMG Cache key: %s <BR>     
  32 Key: %s <BR>   
  33 Cache exists: %s <BR>     
  34 Meta cache exists: %s <BR>
  35 Needs Update: %s <BR> 
  36 """ % (img._cache_key, key, cache.exists(request, key), meta_cache.exists(), meta_cache.needsUpdate(img._filename))
  37         return result
  38     
  39     return "Attachment not found"

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2009-08-03 17:23:57, 1.3 KB) [[attachment:Cachetest.py]]
  • [get | view] (2009-08-03 12:34:28, 1.2 KB) [[attachment:Fuid.py]]
  • [get | view] (2011-11-29 04:14:28, 2428.0 KB) [[attachment:IMGP3941.JPG]]
  • [get | view] (2009-07-14 09:50:09, 22.6 KB) [[attachment:arnica-umlaut.jpg]]
  • [get | view] (2011-08-31 09:50:10, 6.9 KB) [[attachment:google-chrome-navigation-not-working.png]]
  • [get | view] (2009-01-21 22:16:17, 562.4 KB) [[attachment:result.zip]]
  • [get | view] (2009-01-23 17:35:55, 62.5 KB) [[attachment:result1.png]]
  • [get | view] (2009-01-23 17:35:50, 228.7 KB) [[attachment:result10.png]]
  • [get | view] (2012-02-11 20:51:16, 51.5 KB) [[attachment:result11.png]]
  • [get | view] (2012-02-11 20:52:49, 73.9 KB) [[attachment:result12.png]]
  • [get | view] (2009-01-21 22:17:08, 30.1 KB) [[attachment:result2.png]]
  • [get | view] (2009-01-23 17:35:59, 47.8 KB) [[attachment:result3.png]]
  • [get | view] (2009-01-23 17:36:04, 16.7 KB) [[attachment:result4.png]]
  • [get | view] (2009-01-23 17:36:09, 32.3 KB) [[attachment:result5.png]]
  • [get | view] (2009-01-23 17:36:14, 14.8 KB) [[attachment:result6.png]]
  • [get | view] (2009-01-23 17:36:18, 30.1 KB) [[attachment:result7.png]]
  • [get | view] (2009-01-23 17:36:24, 32.0 KB) [[attachment:result8.png]]
  • [get | view] (2009-01-23 17:36:30, 70.6 KB) [[attachment:result9.png]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.