comparison MoinMoin/action/cache.py @ 4376:eda647742453

merged moin/1.8
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 05 Oct 2008 00:38:07 +0200
parents c2ee4633b9e8 817d99d715fe
children 5ad5753ae311
comparison
equal deleted inserted replaced
4335:4e55366ea37a 4376:eda647742453
25 25
26 @copyright: 2008 MoinMoin:ThomasWaldmann 26 @copyright: 2008 MoinMoin:ThomasWaldmann
27 @license: GNU GPL, see COPYING for details. 27 @license: GNU GPL, see COPYING for details.
28 """ 28 """
29 29
30 import hmac, sha
31
32 from MoinMoin import log 30 from MoinMoin import log
33 logging = log.getLogger(__name__) 31 logging = log.getLogger(__name__)
34 32
35 # keep both imports below as they are, order is important: 33 # keep both imports below as they are, order is important:
36 from MoinMoin import wikiutil 34 from MoinMoin import wikiutil
37 import mimetypes 35 import mimetypes
38 36
39 from MoinMoin import config, caching 37 from MoinMoin import config, caching
40 from MoinMoin.util import filesys 38 from MoinMoin.util import filesys
41 from MoinMoin.action import AttachFile 39 from MoinMoin.action import AttachFile
40 from MoinMoin.support.python_compatibility import hmac_new
42 41
43 action_name = __name__.split('.')[-1] 42 action_name = __name__.split('.')[-1]
44 43
45 # Do NOT get this directly from request.form or user would be able to read any cache! 44 # Do NOT get this directly from request.form or user would be able to read any cache!
46 cache_arena = 'sendcache' # just using action_name is maybe rather confusing 45 cache_arena = 'sendcache' # just using action_name is maybe rather confusing
96 hmac_data = u''.join([wikiname, itemname, attachname, repr(fuid)]) 95 hmac_data = u''.join([wikiname, itemname, attachname, repr(fuid)])
97 else: 96 else:
98 raise AssertionError('cache_key called with unsupported parameters') 97 raise AssertionError('cache_key called with unsupported parameters')
99 98
100 hmac_data = hmac_data.encode('utf-8') 99 hmac_data = hmac_data.encode('utf-8')
101 key = hmac.new(secret, hmac_data, sha).hexdigest() 100 key = hmac_new(secret, hmac_data).hexdigest()
102 return key 101 return key
103 102
104 103
105 def put(request, key, data, 104 def put(request, key, data,
106 filename=None, 105 filename=None,