comparison MoinMoin/wikiutil.py @ 1550:a4f0632414da

using request.cfg.cache more
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 14 Sep 2006 22:49:42 +0200
parents e36313297589
children 0d2f2d531e81
comparison
equal deleted inserted replaced
1549:e36313297589 1550:a4f0632414da
1146 @param cfg: the Config instance for the wiki in question 1146 @param cfg: the Config instance for the wiki in question
1147 @param extension: the filename extension including the dot 1147 @param extension: the filename extension including the dot
1148 @rtype: class, None 1148 @rtype: class, None
1149 @returns: the parser class or None 1149 @returns: the parser class or None
1150 """ 1150 """
1151 if not hasattr(cfg, '_EXT_TO_PARSER'): 1151 if not hasattr(cfg.cache, 'EXT_TO_PARSER'):
1152 etp, etd = {}, None 1152 etp, etd = {}, None
1153 for pname in getPlugins('parser', cfg): 1153 for pname in getPlugins('parser', cfg):
1154 try: 1154 try:
1155 Parser = importPlugin(cfg, 'parser', pname, 'Parser') 1155 Parser = importPlugin(cfg, 'parser', pname, 'Parser')
1156 except PluginMissingError: 1156 except PluginMissingError:
1160 if isinstance(exts, list): 1160 if isinstance(exts, list):
1161 for ext in Parser.extensions: 1161 for ext in Parser.extensions:
1162 etp[ext] = Parser 1162 etp[ext] = Parser
1163 elif str(exts) == '*': 1163 elif str(exts) == '*':
1164 etd = Parser 1164 etd = Parser
1165 cfg._EXT_TO_PARSER = etp 1165 cfg.cache.EXT_TO_PARSER = etp
1166 cfg._EXT_TO_PARSER_DEFAULT = etd 1166 cfg.cache.EXT_TO_PARSER_DEFAULT = etd
1167 1167
1168 return cfg._EXT_TO_PARSER.get(extension, cfg._EXT_TO_PARSER_DEFAULT) 1168 return cfg.cache.EXT_TO_PARSER.get(extension, cfg.cache.EXT_TO_PARSER_DEFAULT)
1169 1169
1170 1170
1171 ############################################################################# 1171 #############################################################################
1172 ### Parameter parsing 1172 ### Parameter parsing
1173 ############################################################################# 1173 #############################################################################