comparison MoinMoin/wikiutil.py @ 1181:a7f8dceb4410

remove types module usage
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 14 Aug 2006 00:12:34 +0200
parents 2be8ec7ba817
children 9608758dca9a
comparison
equal deleted inserted replaced
1180:c1c0d7f6f2b4 1181:a7f8dceb4410
9 import cgi 9 import cgi
10 import codecs 10 import codecs
11 import os 11 import os
12 import re 12 import re
13 import time 13 import time
14 import types
15 import urllib 14 import urllib
16 15
17 from MoinMoin import util, version, config 16 from MoinMoin import util, version, config
18 from MoinMoin.util import pysupport, filesys, lock 17 from MoinMoin.util import pysupport, filesys, lock
19 18
1129 Parser = importPlugin(cfg, 'parser', pname, 'Parser') 1128 Parser = importPlugin(cfg, 'parser', pname, 'Parser')
1130 except PluginMissingError: 1129 except PluginMissingError:
1131 continue 1130 continue
1132 if hasattr(Parser, 'extensions'): 1131 if hasattr(Parser, 'extensions'):
1133 exts = Parser.extensions 1132 exts = Parser.extensions
1134 if type(exts) == types.ListType: 1133 if isinstance(exts, list):
1135 for ext in Parser.extensions: 1134 for ext in Parser.extensions:
1136 etp[ext] = Parser 1135 etp[ext] = Parser
1137 elif str(exts) == '*': 1136 elif str(exts) == '*':
1138 etd = Parser 1137 etd = Parser
1139 cfg._EXT_TO_PARSER = etp 1138 cfg._EXT_TO_PARSER = etp
1529 ### Tickets - used by RenamePage and DeletePage 1528 ### Tickets - used by RenamePage and DeletePage
1530 ######################################################################## 1529 ########################################################################
1531 1530
1532 def createTicket(tm=None): 1531 def createTicket(tm=None):
1533 """Create a ticket using a site-specific secret (the config)""" 1532 """Create a ticket using a site-specific secret (the config)"""
1534 import sha, time, types 1533 import sha
1535 ticket = tm or "%010x" % time.time() 1534 ticket = tm or "%010x" % time.time()
1536 digest = sha.new() 1535 digest = sha.new()
1537 digest.update(ticket) 1536 digest.update(ticket)
1538 1537
1539 cfgvars = vars(config) 1538 cfgvars = vars(config)
1540 for var in cfgvars.values(): 1539 for var in cfgvars.values():
1541 if type(var) is types.StringType: 1540 if isinstance(var, str):
1542 digest.update(repr(var)) 1541 digest.update(repr(var))
1543 1542
1544 return "%s.%s" % (ticket, digest.hexdigest()) 1543 return "%s.%s" % (ticket, digest.hexdigest())
1545 1544
1546 1545