fixed language selection bug

added unittest to CryptoBoxPlugin
lars 17 years ago
parent 10c52fb51c
commit 0d41663ec3

@ -118,3 +118,18 @@ class CryptoBoxPlugin:
except KeyError, TypeError:
return self.rank
def getTestClass(self):
import imp
pl_file = os.path.join(self.pluginDir, "")
if os.access(pl_file, os.R_OK) and os.path.isfile(pl_file):
return getattr(imp.load_source("unittests_%s" % self.getName(), pl_file), "unittests")
except AttributeError:
try:"could not load unittests for plugin: %s" % self.getName())
except AttributeError:
return None

@ -89,7 +89,7 @@ class WebInterfaceSites:
else:"unknown user: %s" % str(user))
## wrong credentials: return "access denied"
cherrypy.response.headers["WWW-Authenticate"] = '''Basic realm="Test-Arena"'''
cherrypy.response.headers["WWW-Authenticate"] = '''Basic realm="CryptoBox"'''
cherrypy.response.status = 401
return self.__render("access_denied")
return _inner_wrapper
@ -242,10 +242,13 @@ class WebInterfaceSites:
## no language specified: check browser language
if not guess:
guess = self.__getPreferredBrowserLanguage(availLangs)
if not guess or \
not guess in availLangs or \'\W', guess):"invalid language choosen: %s" % guess)
## no preferred language or invalid language?
if not guess \
or not guess in availLangs \
or'\W', guess):
## warn only for invalid languages
if not guess is None:"invalid language choosen: %s" % guess)
guess = self.prefs["WebSettings"]["Language"]
## maybe the language is still not valid
if not guess in availLangs:

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2.4
import unittest
import CryptoBoxTools