diff options
author | hardythe1 | 2015-05-27 15:03:08 +0530 |
---|---|---|
committer | hardythe1 | 2015-05-27 15:03:08 +0530 |
commit | a026ccc62edff3531b8ce0ea2a613ccde69c1642 (patch) | |
tree | 88809a4877ed8c762ae1343b75f778a9692062a9 /testapp/exam/language_registry.py | |
parent | a83b57aee80959f11f96ad6a3a738c9fac906e26 (diff) | |
download | online_test-a026ccc62edff3531b8ce0ea2a613ccde69c1642.tar.gz online_test-a026ccc62edff3531b8ce0ea2a613ccde69c1642.tar.bz2 online_test-a026ccc62edff3531b8ce0ea2a613ccde69c1642.zip |
Removed Buildout and related files & made a standard Django project
Diffstat (limited to 'testapp/exam/language_registry.py')
-rw-r--r-- | testapp/exam/language_registry.py | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/testapp/exam/language_registry.py b/testapp/exam/language_registry.py deleted file mode 100644 index 76a23d7..0000000 --- a/testapp/exam/language_registry.py +++ /dev/null @@ -1,36 +0,0 @@ -from settings import code_evaluators -import importlib - -registry = None - -def set_registry(): - global registry - registry = _LanguageRegistry() - -def get_registry(): - return registry - -class _LanguageRegistry(object): - def __init__(self): - self._register = {} - for language, module in code_evaluators.iteritems(): - self._register[language] = None - - # Public Protocol ########## - def get_class(self, language): - """ Get the code evaluator class for the given language """ - if not self._register.get(language): - self._register[language] = code_evaluators.get(language) - - cls = self._register[language] - module_name, class_name = cls.rsplit(".", 1) - # load the module, will raise ImportError if module cannot be loaded - get_module = importlib.import_module(module_name) - # get the class, will raise AttributeError if class cannot be found - get_class = getattr(get_module, class_name) - return get_class - - def register(self, language, class_name): - """ Register a new code evaluator class for language""" - self._register[language] = class_name - |