comparison MoinMoin/macro/FootNote.py @ 4363:817d99d715fe

remove direct usage of deprecated sha module - use hashlib, if possible
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 03 Oct 2008 22:33:35 +0200
parents a799b224389f
children a8dec8a9071c
comparison
equal deleted inserted replaced
4362:adec0c4861f7 4363:817d99d715fe
9 2007 MoinMoin:ReimarBauer, 9 2007 MoinMoin:ReimarBauer,
10 2007 Johannes Berg 10 2007 Johannes Berg
11 @license: GNU GPL, see COPYING for details. 11 @license: GNU GPL, see COPYING for details.
12 """ 12 """
13 13
14 import sha
15
16 from MoinMoin import config, wikiutil 14 from MoinMoin import config, wikiutil
17 from MoinMoin.parser.text_moin_wiki import Parser as WikiParser 15 from MoinMoin.parser.text_moin_wiki import Parser as WikiParser
16 from MoinMoin.support.python_compatibility import hash_new
18 17
19 Dependencies = ["time"] # footnote macro cannot be cached 18 Dependencies = ["time"] # footnote macro cannot be cached
20 19
21 def execute(macro, args): 20 def execute(macro, args):
22 request = macro.request 21 request = macro.request
33 else: 32 else:
34 # grab new footnote backref number 33 # grab new footnote backref number
35 idx = request.footnote_ctr 34 idx = request.footnote_ctr
36 request.footnote_ctr += 1 35 request.footnote_ctr += 1
37 36
38 shahex = sha.new(args.encode(config.charset)).hexdigest() 37 shahex = hash_new('sha1', args.encode(config.charset)).hexdigest()
39 backlink_id = "fndef-%s-%d" % (shahex, idx) 38 backlink_id = "fndef-%s-%d" % (shahex, idx)
40 fwdlink_id = "fnref-%s" % shahex 39 fwdlink_id = "fnref-%s" % shahex
41 40
42 if not args in request.footnotes: 41 if not args in request.footnotes:
43 showidx = request.footnote_show_ctr 42 showidx = request.footnote_show_ctr