From 7ac8fecb38582cfa0f7a73e8a223dfd08affe543 Mon Sep 17 00:00:00 2001 From: Calen Pennington <calen.pennington@gmail.com> Date: Mon, 2 Jul 2012 09:01:08 -0400 Subject: [PATCH] Rename XModule[Descriptor].type to .category to be parallel to Location --- cms/djangoapps/contentstore/views.py | 2 +- cms/templates/unit.html | 2 +- common/lib/xmodule/x_module.py | 4 ++-- lms/djangoapps/courseware/grades.py | 4 ++-- lms/djangoapps/courseware/module_render.py | 10 +++++----- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cms/djangoapps/contentstore/views.py b/cms/djangoapps/contentstore/views.py index b85e9c05bf1..f7d5efe22ae 100644 --- a/cms/djangoapps/contentstore/views.py +++ b/cms/djangoapps/contentstore/views.py @@ -22,7 +22,7 @@ def edit_item(request): return render_to_response('unit.html', { 'contents': item.get_html(), 'js_module': item.js_module_name(), - 'type': item.type, + 'category': item.category, 'name': item.name, }) diff --git a/cms/templates/unit.html b/cms/templates/unit.html index 59044ab28d3..34e21ca0491 100644 --- a/cms/templates/unit.html +++ b/cms/templates/unit.html @@ -2,7 +2,7 @@ <header> <section> <h1 class="editable">${name}</h1> - <p>${type}</p> + <p>${category}</p> </section> <div class="actions"> diff --git a/common/lib/xmodule/x_module.py b/common/lib/xmodule/x_module.py index 35cde8b6f4e..f791e7f3074 100644 --- a/common/lib/xmodule/x_module.py +++ b/common/lib/xmodule/x_module.py @@ -95,7 +95,7 @@ class XModule(object): self.shared_state = shared_state self.id = self.location.url() self.name = self.location.name - self.type = self.location.category + self.category = self.location.category self.metadata = kwargs.get('metadata', {}) self._loaded_children = None @@ -235,7 +235,7 @@ class XModuleDescriptor(Plugin): self.system = system self.definition = definition if definition is not None else {} self.name = Location(kwargs.get('location')).name - self.type = Location(kwargs.get('location')).category + self.category = Location(kwargs.get('location')).category self.url = Location(kwargs.get('location')).url() self.metadata = kwargs.get('metadata', {}) self.shared_state_key = kwargs.get('shared_state_key') diff --git a/lms/djangoapps/courseware/grades.py b/lms/djangoapps/courseware/grades.py index deab9d47d4c..b9b89d6cd4e 100644 --- a/lms/djangoapps/courseware/grades.py +++ b/lms/djangoapps/courseware/grades.py @@ -146,9 +146,9 @@ def get_score(user, problem, cache): correct = 0.0 # If the ID is not in the cache, add the item - instance_module = cache.lookup(problem.type, problem.id) + instance_module = cache.lookup(problem.category, problem.id) if instance_module is None: - instance_module = StudentModule(module_type=problem.type, + instance_module = StudentModule(module_type=problem.category, module_state_key=problem.id, student=user, state=None, diff --git a/lms/djangoapps/courseware/module_render.py b/lms/djangoapps/courseware/module_render.py index 6cf4e43cc50..2d47a552484 100644 --- a/lms/djangoapps/courseware/module_render.py +++ b/lms/djangoapps/courseware/module_render.py @@ -207,10 +207,10 @@ def get_module(user, request, location, student_module_cache, position=None): ''' descriptor = keystore().get_item(location) - instance_module = student_module_cache.lookup(descriptor.type, descriptor.url) + instance_module = student_module_cache.lookup(descriptor.category, descriptor.url) shared_state_key = getattr(descriptor, 'shared_state_key', None) if shared_state_key is not None: - shared_module = student_module_cache.lookup(descriptor.type, shared_state_key) + shared_module = student_module_cache.lookup(descriptor.category, shared_state_key) else: shared_module = None @@ -246,7 +246,7 @@ def get_module(user, request, location, student_module_cache, position=None): if not instance_module: instance_module = StudentModule( student=user, - module_type=descriptor.type, + module_type=descriptor.category, module_state_key=module.id, state=module.get_instance_state(), max_grade=module.max_score()) @@ -257,13 +257,13 @@ def get_module(user, request, location, student_module_cache, position=None): if not shared_module and shared_state_key is not None: shared_module = StudentModule( student=user, - module_type=descriptor.type, + module_type=descriptor.category, module_state_key=shared_state_key, state=module.get_shared_state()) shared_module.save() student_module_cache.append(shared_module) - return (module, instance_module, shared_module, descriptor.type) + return (module, instance_module, shared_module, descriptor.category) def add_histogram(module): -- GitLab