comparison MoinMoin/security/textcha.py @ 3159:915a431b663c

logging: security package refactored, moved frozenset to python_compatibility
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 01 Mar 2008 22:24:51 +0100
parents a48929a5036c
children a952d07dea69
comparison
equal deleted inserted replaced
3158:3ea8d2e4af32 3159:915a431b663c
52 if disabled_group and user.name and request.dicts.has_member(disabled_group, user.name): 52 if disabled_group and user.name and request.dicts.has_member(disabled_group, user.name):
53 return None 53 return None
54 textchas = cfg.textchas 54 textchas = cfg.textchas
55 if textchas: 55 if textchas:
56 lang = user.language or request.lang 56 lang = user.language or request.lang
57 #logging.debug(u"TextCha: user.language == '%s'." % lang) 57 logging.debug(u"TextCha: user.language == '%s'." % lang)
58 if lang not in textchas: 58 if lang not in textchas:
59 lang = cfg.language_default 59 lang = cfg.language_default
60 #logging.debug(u"TextCha: fallback to language_default == '%s'." % lang) 60 logging.debug(u"TextCha: fallback to language_default == '%s'." % lang)
61 if lang not in textchas: 61 if lang not in textchas:
62 logging.error(u"TextCha: The textchas do not have content for language_default == '%s'! Falling back to English." % lang) 62 logging.error(u"TextCha: The textchas do not have content for language_default == '%s'! Falling back to English." % lang)
63 lang = 'en' 63 lang = 'en'
64 if lang not in textchas: 64 if lang not in textchas:
65 logging.error(u"TextCha: The textchas do not have content for 'en', auto-disabling textchas!") 65 logging.error(u"TextCha: The textchas do not have content for 'en', auto-disabling textchas!")
68 else: 68 else:
69 lang = None 69 lang = None
70 if lang is None: 70 if lang is None:
71 return None 71 return None
72 else: 72 else:
73 #logging.debug(u"TextCha: using lang = '%s'" % lang) 73 logging.debug(u"TextCha: using lang = '%s'" % lang)
74 return textchas[lang] 74 return textchas[lang]
75 75
76 def _init_qa(self, question=None): 76 def _init_qa(self, question=None):
77 """ Initialize the question / answer. 77 """ Initialize the question / answer.
78 78