diff --git a/common/lib/xmodule/xmodule/modulestore/xml.py b/common/lib/xmodule/xmodule/modulestore/xml.py index d85b6d2cad..3e6e54be45 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml.py +++ b/common/lib/xmodule/xmodule/modulestore/xml.py @@ -1,5 +1,4 @@ import logging -from django.conf import settings from fs.osfs import OSFS from importlib import import_module from lxml import etree @@ -129,8 +128,7 @@ class XMLModuleStore(ModuleStore): """ Returns a list of course descriptors """ - # return self.courses - return settings.COURSES + return self.courses def create_item(self, location): raise NotImplementedError("XMLModuleStores are read-only") diff --git a/lms/djangoapps/courseware/courses.py b/lms/djangoapps/courseware/courses.py index 43347f719d..52be6a7cbd 100644 --- a/lms/djangoapps/courseware/courses.py +++ b/lms/djangoapps/courseware/courses.py @@ -27,31 +27,6 @@ class Course(namedtuple('Course', _FIELDS)): """Course objects encapsulate general information about a given run of a course. This includes things like name, grading policy, etc. """ - @property - def id(self): - return "{0.institution},{0.number},{0.run_id}".format(self).replace(" ", "_") - - def get_about_section(self, section): - if section == "university": - section = "institution" - if section in _FIELDS: - getattr(self, section) - else: - return section - - @classmethod - def load_from_path(cls, course_path): - course_path = path(course_path) # convert it from string if necessary - try: - with open(course_path / "course_info.yaml") as course_info_file: - course_info = yaml.load(course_info_file) - summary = course_info['course'] - summary.update(path=course_path, grader=None) - return cls(**summary) - except Exception as ex: - log.exception(ex) - raise CourseInfoLoadError("Could not read course info: {0}:{1}" - .format(type(ex).__name__, ex)) def load_courses(courses_path): """Given a directory of courses, returns a list of Course objects. For the diff --git a/lms/djangoapps/courseware/views.py b/lms/djangoapps/courseware/views.py index 8dd278be55..403a472d42 100644 --- a/lms/djangoapps/courseware/views.py +++ b/lms/djangoapps/courseware/views.py @@ -54,9 +54,7 @@ def format_url_params(params): def courses(request): csrf_token = csrf(request)['csrf_token'] # TODO: Clean up how 'error' is done. - # context = {'courses': modulestore().get_courses(), - # 'csrf': csrf_token} - context = {'courses': settings.COURSES, + context = {'courses': modulestore().get_courses(), 'csrf': csrf_token} return render_to_response("courses.html", context) @@ -254,9 +252,8 @@ def course_info(request, course_id): csrf_token = csrf(request)['csrf_token'] try: - # course_location = CourseDescriptor.id_to_location(course_id) - # course = modulestore().get_item(course_location) - course = settings.COURSES_BY_ID[course_id] + course_location = CourseDescriptor.id_to_location(course_id) + course = modulestore().get_item(course_location) except KeyError: raise Http404("Course not found") diff --git a/lms/djangoapps/student/views.py b/lms/djangoapps/student/views.py index 06cd41dedc..3319b33207 100644 --- a/lms/djangoapps/student/views.py +++ b/lms/djangoapps/student/views.py @@ -491,9 +491,8 @@ def accept_name_change(request): def course_info(request, course_id): # This is the advertising page for a student to look at the course before signing up csrf_token = csrf(request)['csrf_token'] - # course_loc = CourseDescriptor.id_to_location(course_id) - # course = modulestore().get_item(course_loc) - course = settings.COURSES_BY_ID[course_id] + course_loc = CourseDescriptor.id_to_location(course_id) + course = modulestore().get_item(course_loc) # TODO: Couse should be a model return render_to_response('portal/course_about.html', {'csrf': csrf_token, 'course': course}) diff --git a/lms/envs/common.py b/lms/envs/common.py index 8a9530de09..928aa2bd01 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -64,12 +64,6 @@ sys.path.append(PROJECT_ROOT / 'lib') sys.path.append(COMMON_ROOT / 'djangoapps') sys.path.append(COMMON_ROOT / 'lib') -######### EDX dormsbee/portal changes ################# -from courseware.courses import create_lookup_table, load_courses -COURSES = load_courses(ENV_ROOT / "data") -COURSES_BY_ID = create_lookup_table(COURSES) -####################################################### - ################################## MITXWEB ##################################### # This is where we stick our compiled template files. Most of the app uses Mako # templates diff --git a/lms/envs/dev.py b/lms/envs/dev.py index decd92d136..f175ca1f53 100644 --- a/lms/envs/dev.py +++ b/lms/envs/dev.py @@ -11,7 +11,7 @@ from .common import * from .logsettings import get_logger_config DEBUG = True -TEMPLATE_DEBUG = True +TEMPLATE_DEBUG = False LOGGING = get_logger_config(ENV_ROOT / "log", logging_env="dev", diff --git a/lms/templates/course.html b/lms/templates/course.html index 3ae00f88a2..35f9e46acf 100644 --- a/lms/templates/course.html +++ b/lms/templates/course.html @@ -2,7 +2,33 @@ <%! from django.core.urlresolvers import reverse %> -<%page args="course"/> + +%for course in courses: +
+
+
+ +
+

${course.title}

+
+ +
+
+
+
+

${course.institution}

+

7/23/1212/15/12

+
+
+ +
+
+

An advanced introduction to analog circuits.

+
+
+
+
+%endfor
@@ -20,7 +46,132 @@

7/23/1212/15/12

- + +
+
+

An advanced introduction to analog circuits.

+
+ + +
+ +
+
+
+ +
+

${course.title}

+
+ +
+
+
+
+

${course.institution}

+

7/23/1212/15/12

+
+
+ +
+
+

An advanced introduction to analog circuits.

+
+
+
+
+ +
+
+
+ +
+

${course.title}

+
+ +
+
+
+
+

${course.institution}

+

7/23/1212/15/12

+
+
+ +
+
+

An advanced introduction to analog circuits.

+
+
+
+
+ +
+
+
+ +
+

${course.title}

+
+ +
+
+
+
+

${course.institution}

+

7/23/1212/15/12

+
+
+ +
+
+

An advanced introduction to analog circuits.

+
+
+
+
+ +
+
+
+ +
+

${course.title}

+
+ +
+
+
+
+

${course.institution}

+

7/23/1212/15/12

+
+
+ +
+
+

An advanced introduction to analog circuits.

+
+
+
+
+ +
+
+
+ +
+

${course.title}

+
+ +
+
+
+
+

${course.institution}

+

7/23/1212/15/12

+
+
+

An advanced introduction to analog circuits.

diff --git a/lms/urls.py b/lms/urls.py index 9cb6a9483b..0f3d78770e 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -69,24 +69,15 @@ if settings.COURSEWARE_ENABLED: # Multicourse related: url(r'^courses/?$', 'courseware.views.courses', name="courses"), - url(r'^courses/(?P[^/]*)/info$', 'courseware.views.course_info', name="info"), - url(r'^courses/(?P[^/]*)/book$', 'staticbook.views.index', name="book"), - url(r'^courses/(?P[^/]*)/enroll$', 'student.views.enroll', name="enroll"), - url(r'^courses/(?P[^/]*)/courseware/?$', 'courseware.views.index', name="courseware"), - url(r'^courses/(?P[^/]*)/courseware/(?P[^/]*)/(?P
[^/]*)/$', 'courseware.views.index', name="courseware_section"), - url(r'^courses/(?P[^/]*)/profile$', 'courseware.views.profile', name="profile"), - url(r'^courses/(?P[^/]*)/profile/(?P[^/]*)/$', 'courseware.views.profile'), + url(r'^courses/(?P[^/]+/[^/]+/[^/])/info$', 'courseware.views.course_info', name="info"), + url(r'^courses/(?P[^/]+/[^/]+/[^/])/book$', 'staticbook.views.index', name="book"), + url(r'^courses/(?P[^/]+/[^/]+/[^/])/enroll$', 'student.views.enroll', name="enroll"), + url(r'^courses/(?P[^/]+/[^/]+/[^/])/courseware/?$', 'courseware.views.index', name="courseware"), + url(r'^courses/(?P[^/]+/[^/]+/[^/])/courseware/(?P[^/]*)/(?P
[^/]*)/$', 'courseware.views.index', name="courseware_section"), + url(r'^courses/(?P[^/]+/[^/]+/[^/])/profile$', 'courseware.views.profile', name="profile"), + url(r'^courses/(?P[^/]+/[^/]+/[^/])/profile/(?P[^/]*)/$', 'courseware.views.profile'), - # url(r'^courses/(?P[^/]+/[^/]+/[^/])/info$', 'courseware.views.course_info', name="info"), - # url(r'^courses/(?P[^/]+/[^/]+/[^/])/book$', 'staticbook.views.index', name="book"), - # url(r'^courses/(?P[^/]+/[^/]+/[^/])/enroll$', 'student.views.enroll', name="enroll"), - # url(r'^courses/(?P[^/]+/[^/]+/[^/])/courseware/?$', 'courseware.views.index', name="courseware"), - # url(r'^courses/(?P[^/]+/[^/]+/[^/])/courseware/(?P[^/]*)/(?P
[^/]*)/$', 'courseware.views.index', name="courseware_section"), - # url(r'^courses/(?P[^/]+/[^/]+/[^/])/profile$', 'courseware.views.profile', name="profile"), - # url(r'^courses/(?P[^/]+/[^/]+/[^/])/profile/(?P[^/]*)/$', 'courseware.views.profile'), - - url(r'^courses/(?P[^/]*)/about$', 'student.views.course_info', name="about_course"), - # url(r'^courses/(?P[^/]+/[^/]+/[^/])/about$', 'courseware.views.course_info', name="about_course"), + url(r'^courses/(?P[^/]+/[^/]+/[^/])/about$', 'courseware.views.course_info', name="about_course"), ) if settings.ENABLE_MULTICOURSE: