Commit baac1eb8 by Bridger Maxwell

Merge

parents 0d699f28 6e7e00c8
...@@ -193,6 +193,12 @@ class LoncapaProblem(object): ...@@ -193,6 +193,12 @@ class LoncapaProblem(object):
if problemtree.tag in html_transforms: if problemtree.tag in html_transforms:
tree.tag=html_transforms[problemtree.tag]['tag'] tree.tag=html_transforms[problemtree.tag]['tag']
# Reset attributes. Otherwise, we get metadata in HTML
# (e.g. answers)
# TODO: We should remove and not zero them.
# I'm not sure how to do that quickly with lxml
for k in tree.keys():
tree.set(k,"")
# TODO: Fix. This loses Element().tail # TODO: Fix. This loses Element().tail
#if problemtree.tag in html_skip: #if problemtree.tag in html_skip:
......
...@@ -17,13 +17,16 @@ class HtmlModule(XModule): ...@@ -17,13 +17,16 @@ class HtmlModule(XModule):
return "html" return "html"
def get_html(self): def get_html(self):
if self.filename!=None: if self.filename==None:
return render_to_string(self.filename, {'id': self.item_id})
else:
xmltree=etree.fromstring(self.xml) xmltree=etree.fromstring(self.xml)
textlist=[xmltree.text]+[etree.tostring(i) for i in xmltree]+[xmltree.tail] textlist=[xmltree.text]+[etree.tostring(i) for i in xmltree]+[xmltree.tail]
textlist=[i for i in textlist if type(i)==str] textlist=[i for i in textlist if type(i)==str]
return "".join(textlist) return "".join(textlist)
try:
filename=settings.DATA_DIR+"html/"+self.filename+".xml"
return open(filename).read()
except: # For backwards compatibility. TODO: Remove
return render_to_string(self.filename, {'id': self.item_id})
def __init__(self, xml, item_id, ajax_url=None, track_url=None, state=None, track_function=None, render_function = None): def __init__(self, xml, item_id, ajax_url=None, track_url=None, state=None, track_function=None, render_function = None):
XModule.__init__(self, xml, item_id, ajax_url, track_url, state, track_function, render_function) XModule.__init__(self, xml, item_id, ajax_url, track_url, state, track_function, render_function)
......
...@@ -328,6 +328,7 @@ LIVESETTINGS_OPTIONS = { ...@@ -328,6 +328,7 @@ LIVESETTINGS_OPTIONS = {
'SETTINGS' : { 'SETTINGS' : {
'MIN_REP' : { 'MIN_REP' : {
'MIN_REP_TO_VOTE_UP' : 1, 'MIN_REP_TO_VOTE_UP' : 1,
'MIN_REP_TO_UPLOAD_FILES' : 1,
}, },
'SOCIAL_SHARING' : { 'SOCIAL_SHARING' : {
'ENABLE_SHARING_TWITTER' : False, 'ENABLE_SHARING_TWITTER' : False,
......
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