summaryrefslogtreecommitdiff
path: root/testapp/exam/language_registry.py
diff options
context:
space:
mode:
authorankitjavalkar2015-04-24 14:25:26 +0530
committerankitjavalkar2015-04-26 21:11:52 +0530
commit8664a766406d6acf0d6a1688948153c407ea27f2 (patch)
tree7505ef02b5e36395fc7e92ff5cde7700f2025979 /testapp/exam/language_registry.py
parent17752a69114e7dbad266337e768013920aec8c0c (diff)
downloadonline_test-8664a766406d6acf0d6a1688948153c407ea27f2.tar.gz
online_test-8664a766406d6acf0d6a1688948153c407ea27f2.tar.bz2
online_test-8664a766406d6acf0d6a1688948153c407ea27f2.zip
Code Review: Code refactoring
- Rename files - Create function for @classmethod call - Fix current, add new testcases - Fix views to fetch solution/ref_code_path fields in question post save - Fix errors
Diffstat (limited to 'testapp/exam/language_registry.py')
-rw-r--r--testapp/exam/language_registry.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/testapp/exam/language_registry.py b/testapp/exam/language_registry.py
new file mode 100644
index 0000000..207cd21
--- /dev/null
+++ b/testapp/exam/language_registry.py
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+
+class LanguageRegistry(object):
+ def __init__(self):
+ self._registry = {}
+
+ ## Public Protocol ##########
+ def get_class(self, language):
+ return self._registry[language]
+
+ ## Public Protocol ##########
+ def register(self, language, cls):
+ self._registry[language] = cls
+
+
+registry = LanguageRegistry() \ No newline at end of file