comparison MoinMoin/action/cache.py @ 6103:500f68d3e2fd

remove our own usage of python_compatibility module
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 06 Sep 2016 01:00:25 +0200
parents d73431c6d2c9
children 561b7a9c2bd9
comparison
equal deleted inserted replaced
6102:df21062e294d 6103:500f68d3e2fd
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 from datetime import datetime 30 from datetime import datetime
31 import hmac
31 32
32 from MoinMoin import log 33 from MoinMoin import log
33 logging = log.getLogger(__name__) 34 logging = log.getLogger(__name__)
34 35
35 # keep both imports below as they are, order is important: 36 # keep both imports below as they are, order is important:
37 import mimetypes 38 import mimetypes
38 39
39 from MoinMoin import config, caching 40 from MoinMoin import config, caching
40 from MoinMoin.util import filesys 41 from MoinMoin.util import filesys
41 from MoinMoin.action import AttachFile 42 from MoinMoin.action import AttachFile
42 from MoinMoin.support.python_compatibility import hmac_new
43 43
44 action_name = __name__.split('.')[-1] 44 action_name = __name__.split('.')[-1]
45 45
46 # Do NOT get this directly from request.values or user would be able to read any cache! 46 # Do NOT get this directly from request.values or user would be able to read any cache!
47 cache_arena = 'sendcache' # just using action_name is maybe rather confusing 47 cache_arena = 'sendcache' # just using action_name is maybe rather confusing
97 hmac_data = u''.join([wikiname, itemname, attachname, repr(fuid)]) 97 hmac_data = u''.join([wikiname, itemname, attachname, repr(fuid)])
98 else: 98 else:
99 raise AssertionError('cache_key called with unsupported parameters') 99 raise AssertionError('cache_key called with unsupported parameters')
100 100
101 hmac_data = hmac_data.encode('utf-8') 101 hmac_data = hmac_data.encode('utf-8')
102 key = hmac_new(secret, hmac_data).hexdigest() 102 key = hmac.new(secret, hmac_data).hexdigest()
103 return key 103 return key
104 104
105 105
106 def put(request, key, data, 106 def put(request, key, data,
107 filename=None, 107 filename=None,