summaryrefslogtreecommitdiff
path: root/testapp/yaksh_app/language_registry.py
diff options
context:
space:
mode:
authorPrabhu Ramachandran2015-09-29 13:45:06 +0530
committerPrabhu Ramachandran2015-09-29 13:45:06 +0530
commitebbf135af98720f1979cd28a9108817bac385ce7 (patch)
treee812ac5466ad043f867c58bc363df823522a8468 /testapp/yaksh_app/language_registry.py
parent31f5e743031d105b0406e9587dc33bb065cd6e4d (diff)
parent53be4bc2ec40a9a84ff5ea73db2fbea0a07f5338 (diff)
downloadonline_test-ebbf135af98720f1979cd28a9108817bac385ce7.tar.gz
online_test-ebbf135af98720f1979cd28a9108817bac385ce7.tar.bz2
online_test-ebbf135af98720f1979cd28a9108817bac385ce7.zip
Merge pull request #56 from ankitjavalkar/examtime
Start and Expiry times for Quizzes
Diffstat (limited to 'testapp/yaksh_app/language_registry.py')
-rw-r--r--testapp/yaksh_app/language_registry.py36
1 files changed, 0 insertions, 36 deletions
diff --git a/testapp/yaksh_app/language_registry.py b/testapp/yaksh_app/language_registry.py
deleted file mode 100644
index 76a23d7..0000000
--- a/testapp/yaksh_app/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
-