diff options
author | Prabhu Ramachandran | 2017-09-15 16:31:50 +0530 |
---|---|---|
committer | GitHub | 2017-09-15 16:31:50 +0530 |
commit | 7419e3b3f4e14f86f21f9464843f9263638fe7a2 (patch) | |
tree | a046617f76879ea5c056ae2c8f39b0a97c8a18a7 /yaksh/models.py | |
parent | e3a43662d2aae8688039671d3de532e48fbdfda9 (diff) | |
parent | f65102cf4b6a117a3ff86971ad9c1ddd3362c9fd (diff) | |
download | online_test-7419e3b3f4e14f86f21f9464843f9263638fe7a2.tar.gz online_test-7419e3b3f4e14f86f21f9464843f9263638fe7a2.tar.bz2 online_test-7419e3b3f4e14f86f21f9464843f9263638fe7a2.zip |
Merge pull request #326 from FOSSEE/improve-code-server
Improve code server
Diffstat (limited to 'yaksh/models.py')
-rw-r--r-- | yaksh/models.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index 063e1e3..d9e07fd 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -28,7 +28,7 @@ import tempfile from textwrap import dedent from ast import literal_eval from .file_utils import extract_files, delete_files -from yaksh.xmlrpc_clients import code_server +from yaksh.code_server import submit, SERVER_POOL_PORT from django.conf import settings from django.forms.models import model_to_dict @@ -1306,7 +1306,7 @@ class AnswerPaper(models.Model): if question.type == 'code': return self.answers.filter(question=question).order_by('-id') - def validate_answer(self, user_answer, question, json_data=None): + def validate_answer(self, user_answer, question, json_data=None, uid=None): """ Checks whether the answer submitted by the user is right or wrong. If right then returns correct = True, success and @@ -1367,10 +1367,9 @@ class AnswerPaper(models.Model): elif question.type == 'code' or question.type == "upload": user_dir = self.user.profile.get_user_dir() - json_result = code_server.run_code( - question.language, json_data, user_dir - ) - result = json.loads(json_result) + url = 'http://localhost:%s' % SERVER_POOL_PORT + submit(url, uid, json_data, user_dir) + result = {'uid': uid, 'status': 'running'} return result def regrade(self, question_id): |