Commit 691744e3 by Victor Shnayder

Use .display_name instead of metadata['display_name']

* the former does a fallback if metadata['display_name'] isn't set.
parent 5e2f6761
...@@ -237,7 +237,7 @@ class CapaModule(XModule): ...@@ -237,7 +237,7 @@ class CapaModule(XModule):
else: else:
raise raise
content = {'name': self.metadata['display_name'], content = {'name': self.display_name,
'html': html, 'html': html,
'weight': self.weight, 'weight': self.weight,
} }
...@@ -464,7 +464,7 @@ class CapaModule(XModule): ...@@ -464,7 +464,7 @@ class CapaModule(XModule):
return {'success': msg} return {'success': msg}
log.exception("Error in capa_module problem checking") log.exception("Error in capa_module problem checking")
raise Exception("error in capa_module") raise Exception("error in capa_module")
self.attempts = self.attempts + 1 self.attempts = self.attempts + 1
self.lcp.done = True self.lcp.done = True
......
...@@ -140,7 +140,7 @@ class CourseDescriptor(SequenceDescriptor): ...@@ -140,7 +140,7 @@ class CourseDescriptor(SequenceDescriptor):
@property @property
def title(self): def title(self):
return self.metadata['display_name'] return self.display_name
@property @property
def number(self): def number(self):
......
...@@ -76,7 +76,7 @@ class SequenceModule(XModule): ...@@ -76,7 +76,7 @@ class SequenceModule(XModule):
contents.append({ contents.append({
'content': child.get_html(), 'content': child.get_html(),
'title': "\n".join( 'title': "\n".join(
grand_child.metadata['display_name'].strip() grand_child.display_name.strip()
for grand_child in child.get_children() for grand_child in child.get_children()
if 'display_name' in grand_child.metadata if 'display_name' in grand_child.metadata
), ),
...@@ -107,7 +107,7 @@ class SequenceModule(XModule): ...@@ -107,7 +107,7 @@ class SequenceModule(XModule):
class SequenceDescriptor(MakoModuleDescriptor, XmlDescriptor): class SequenceDescriptor(MakoModuleDescriptor, XmlDescriptor):
mako_template = 'widgets/sequence-edit.html' mako_template = 'widgets/sequence-edit.html'
module_class = SequenceModule module_class = SequenceModule
stores_state = True # For remembering where in the sequence the student is stores_state = True # For remembering where in the sequence the student is
@classmethod @classmethod
......
...@@ -35,7 +35,7 @@ def manage_modulestores(request,reload_dir=None): ...@@ -35,7 +35,7 @@ def manage_modulestores(request,reload_dir=None):
ip = request.META.get('HTTP_X_REAL_IP','') # nginx reverse proxy ip = request.META.get('HTTP_X_REAL_IP','') # nginx reverse proxy
if not ip: if not ip:
ip = request.META.get('REMOTE_ADDR','None') ip = request.META.get('REMOTE_ADDR','None')
if LOCAL_DEBUG: if LOCAL_DEBUG:
html += '<h3>IP address: %s ' % ip html += '<h3>IP address: %s ' % ip
html += '<h3>User: %s ' % request.user html += '<h3>User: %s ' % request.user
...@@ -48,7 +48,7 @@ def manage_modulestores(request,reload_dir=None): ...@@ -48,7 +48,7 @@ def manage_modulestores(request,reload_dir=None):
html += 'Permission denied' html += 'Permission denied'
html += "</body></html>" html += "</body></html>"
log.debug('request denied, ALLOWED_IPS=%s' % ALLOWED_IPS) log.debug('request denied, ALLOWED_IPS=%s' % ALLOWED_IPS)
return HttpResponse(html) return HttpResponse(html)
#---------------------------------------- #----------------------------------------
# reload course if specified # reload course if specified
...@@ -74,10 +74,10 @@ def manage_modulestores(request,reload_dir=None): ...@@ -74,10 +74,10 @@ def manage_modulestores(request,reload_dir=None):
#---------------------------------------- #----------------------------------------
dumpfields = ['definition','location','metadata'] dumpfields = ['definition','location','metadata']
for cdir, course in def_ms.courses.items(): for cdir, course in def_ms.courses.items():
html += '<hr width="100%"/>' html += '<hr width="100%"/>'
html += '<h2>Course: %s (%s)</h2>' % (course.metadata['display_name'],cdir) html += '<h2>Course: %s (%s)</h2>' % (course.display_name,cdir)
for field in dumpfields: for field in dumpfields:
data = getattr(course,field) data = getattr(course,field)
...@@ -89,7 +89,7 @@ def manage_modulestores(request,reload_dir=None): ...@@ -89,7 +89,7 @@ def manage_modulestores(request,reload_dir=None):
html += '</ul>' html += '</ul>'
else: else:
html += '<ul><li>%s</li></ul>' % escape(data) html += '<ul><li>%s</li></ul>' % escape(data)
#---------------------------------------- #----------------------------------------
...@@ -107,4 +107,4 @@ def manage_modulestores(request,reload_dir=None): ...@@ -107,4 +107,4 @@ def manage_modulestores(request,reload_dir=None):
log.debug('def_ms=%s' % unicode(def_ms)) log.debug('def_ms=%s' % unicode(def_ms))
html += "</body></html>" html += "</body></html>"
return HttpResponse(html) return HttpResponse(html)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment