diff options
author | Prabhu Ramachandran | 2016-10-26 18:42:08 +0530 |
---|---|---|
committer | GitHub | 2016-10-26 18:42:08 +0530 |
commit | f563640af941a50642dc5eb6e63b1d63a1685046 (patch) | |
tree | f4326fe26c0198a0b5a331fe9ec74e6a036ef329 /yaksh | |
parent | 08d8478a6a57991b0130c5610db6efa7bc9e5a66 (diff) | |
parent | a08fab86403b7aa2f813e5bafab08f7777ac3537 (diff) | |
download | online_test-f563640af941a50642dc5eb6e63b1d63a1685046.tar.gz online_test-f563640af941a50642dc5eb6e63b1d63a1685046.tar.bz2 online_test-f563640af941a50642dc5eb6e63b1d63a1685046.zip |
Merge pull request #149 from adityacp/fixed_output_dir_creation
Fixed output directory creation
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/code_evaluator.py | 3 | ||||
-rw-r--r-- | yaksh/models.py | 8 | ||||
-rw-r--r-- | yaksh/output/README.txt | 4 | ||||
-rw-r--r-- | yaksh/views.py | 2 |
4 files changed, 4 insertions, 13 deletions
diff --git a/yaksh/code_evaluator.py b/yaksh/code_evaluator.py index 870a67f..79f616d 100644 --- a/yaksh/code_evaluator.py +++ b/yaksh/code_evaluator.py @@ -94,6 +94,9 @@ class CodeEvaluator(object): # Private Protocol ########## def setup(self): + if self.in_dir: + if not os.path.exists(self.in_dir): + os.makedirs(self.in_dir) self._change_dir(self.in_dir) def safe_evaluate(self, user_answer, test_case_data, file_paths=None): diff --git a/yaksh/models.py b/yaksh/models.py index cc64b98..7f9eead 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -206,12 +206,6 @@ class Profile(models.Model): """Return the output directory for the user.""" user_dir = join(settings.OUTPUT_DIR, str(self.user.username)) - if not exists(user_dir): - os.makedirs(user_dir) - # Make it rwx by others. - os.chmod(user_dir, stat.S_IROTH | stat.S_IWOTH | stat.S_IXOTH - | stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR - | stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP) return user_dir @@ -680,7 +674,7 @@ class QuestionPaper(models.Model): def create_demo_quiz_ppr(self, demo_quiz, user): question_paper = QuestionPaper.objects.create(quiz=demo_quiz, - total_marks=5.0, + total_marks=7.0, shuffle_questions=True ) questions = Question.objects.filter(active=True, diff --git a/yaksh/output/README.txt b/yaksh/output/README.txt deleted file mode 100644 index 3163ed4..0000000 --- a/yaksh/output/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -This directory contains files generated/saved by users as per their -username. The test executor will chdir into this user directory for each -user when they run the test. Do not delete this directory and ensure that -it is writeable by all.
\ No newline at end of file diff --git a/yaksh/views.py b/yaksh/views.py index 68e641e..4706222 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -415,8 +415,6 @@ def start(request, questionpaper_id=None, attempt_num=None): msg = 'You do not have a profile and cannot take the quiz!' raise Http404(msg) new_paper = quest_paper.make_answerpaper(user, ip, attempt_num) - # Make user directory. - user_dir = new_paper.user.profile.get_user_dir() return show_question(request, new_paper.current_question(), new_paper) |