Merge
This commit is contained in:
@@ -193,6 +193,12 @@ class LoncapaProblem(object):
|
||||
|
||||
if problemtree.tag in html_transforms:
|
||||
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
|
||||
#if problemtree.tag in html_skip:
|
||||
|
||||
@@ -17,13 +17,16 @@ class HtmlModule(XModule):
|
||||
return "html"
|
||||
|
||||
def get_html(self):
|
||||
if self.filename!=None:
|
||||
return render_to_string(self.filename, {'id': self.item_id})
|
||||
else:
|
||||
if self.filename==None:
|
||||
xmltree=etree.fromstring(self.xml)
|
||||
textlist=[xmltree.text]+[etree.tostring(i) for i in xmltree]+[xmltree.tail]
|
||||
textlist=[i for i in textlist if type(i)==str]
|
||||
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):
|
||||
XModule.__init__(self, xml, item_id, ajax_url, track_url, state, track_function, render_function)
|
||||
|
||||
@@ -328,6 +328,7 @@ LIVESETTINGS_OPTIONS = {
|
||||
'SETTINGS' : {
|
||||
'MIN_REP' : {
|
||||
'MIN_REP_TO_VOTE_UP' : 1,
|
||||
'MIN_REP_TO_UPLOAD_FILES' : 1,
|
||||
},
|
||||
'SOCIAL_SHARING' : {
|
||||
'ENABLE_SHARING_TWITTER' : False,
|
||||
|
||||
Reference in New Issue
Block a user