summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yaksh/models.py14
-rw-r--r--yaksh/test_views.py6
-rw-r--r--yaksh/views.py2
3 files changed, 3 insertions, 19 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 7686aa0..fd48318 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -391,13 +391,6 @@ class LessonFile(models.Model):
on_delete=models.CASCADE)
file = models.FileField(upload_to=get_file_dir, default=None)
- def remove(self):
- if os.path.exists(self.file.path):
- os.remove(self.file.path)
- if os.listdir(os.path.dirname(self.file.path)) == []:
- os.rmdir(os.path.dirname(self.file.path))
- self.delete()
-
pre_delete.connect(file_cleanup, sender=LessonFile)
###############################################################################
@@ -1695,13 +1688,6 @@ class FileUpload(models.Model):
extract = models.BooleanField(default=False)
hide = models.BooleanField(default=False)
- def remove(self):
- if os.path.exists(self.file.path):
- os.remove(self.file.path)
- if os.listdir(os.path.dirname(self.file.path)) == []:
- os.rmdir(os.path.dirname(self.file.path))
- self.delete()
-
def set_extract_status(self):
if self.extract:
self.extract = False
diff --git a/yaksh/test_views.py b/yaksh/test_views.py
index 925c3d1..65cc30d 100644
--- a/yaksh/test_views.py
+++ b/yaksh/test_views.py
@@ -2234,11 +2234,7 @@ class TestCourses(TestCase):
self.assertTrue(expected_lesson_files.exists())
self.assertEquals(expected_lesson_files[0].file.read(), file_content)
- for lesson_file in self.all_files:
- file_path = lesson_file.file.path
- if os.path.exists(file_path):
- os.remove(file_path)
- shutil.rmtree(os.path.dirname(file_path))
+ self.all_files.delete()
def test_download_course_offline(self):
""" Test to download course with lessons offline"""
diff --git a/yaksh/views.py b/yaksh/views.py
index b6723bc..4a6f462 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -1420,6 +1420,7 @@ def monitor(request, quiz_id=None, course_id=None, attempt_number=1):
def _get_questions(user, question_type, marks):
+ questions = None
if question_type is None and marks is None:
return None
if question_type:
@@ -1447,6 +1448,7 @@ def _remove_already_present(questionpaper_id, questions):
def _get_questions_from_tags(question_tags, user, active=True, questions=None):
search_tags = []
+ search = None
for tags in question_tags:
search_tags.extend(re.split('[; |, |\*|\n]', tags))
if questions: